PDA

View Full Version : 3 Joined Updates, same format, 2 working 1 not


fuzzy1
09-28-2006, 06:59 AM
Okay,

3 joined updates same format, first 2 work last one doesn't can't for the life of me figure out why.

1.This worksUPDATE contacts, campaign_log
SET contacts.invalid_email=1
WHERE contacts.id=campaign_log.target_id
AND campaign_log.activity_type="invalid email"2.This worksUPDATE campaign_log, contacts
SET campaign_log.deleted=1
WHERE contacts.id=campaign_log.target_id
AND contacts.agency_name="FSBO"
3.This only returns an empty setUPDATE campaign_log, emails
SET campaign_log.activity_type="invalid email"
WHERE campaign_log.related_id = emails.id
AND emails.description_html = "X"While this WorksUPDATE campaign_log, emails
SET campaign_log.activity_type="invalid email"
WHERE campaign_log.related_id = emails.id
And this worksSELECT*FROM emails
WHERE emails.description_html = "X"
So what gives???

mlse
09-28-2006, 02:22 PM
Hi,

The first answer that springs to my mind is, does the following query return a value of zero?


SELECT count(0) from campaign_log, emails
WHERE campaign_log.related_id = emails.id
AND emails.description_html = "X";


If so, then that's the problem.

Mike.

fuzzy1
09-28-2006, 04:07 PM
Duhhhhhh (as a bit of droool rolls down my chin...)
Of course 149 qualifying records DID exist in campaign_log.
Let the be a lesson to me!!! Tired? Eyes Burning? Drooling????

GO TO BED BEFORE YOU DELETE SOMETHING YOU SHOULDN'T

I was so fried, was sure it was something I was missing in the queary.
GRRRRRRRR

mlse
09-29-2006, 11:32 AM
That's what backups are for! :)