I read in the mySQL manual, "Currently, you cannot update a table and select from the same table in a subquery." So what is the best way to take the user IDs from this first query...
WHERE sponsorID = 717
and memberType = 'No'
and uID in (select uID from campaigns where type = 'Enrollment' and answer in ('Contact', 'Purchase')
and status = 'Undiscovered');
...and then turn right around and update the campaigns table with this
update campaigns set status = 'Discovered' where uID in (the uIDs from the result of the first query)
try this --
ON users.uID = campaigns.uID
AND users.sponsorID = 717
AND users.memberType = 'No'
AND users.status = 'Undiscovered'
SET campaigns.status = 'Discovered'
WHERE campaigns.type = 'Enrollment'
AND campaigns.answer in ('Contact', 'Purchase')
This topic is now closed. New replies are no longer allowed.