...

View Full Version : Problem with multiple WHERE conditions



chornbeck
10-31-2011, 06:33 PM
Here is my query:


$resultleads = mysql_query("SELECT * FROM LeadTable WHERE Operator = '$CurrentOp' AND CallBackDateTime IS NULL AND (LeadDisposition IS NULL OR LeadDisposition = 'NA' OR LeadDisposition = 'LM') ORDER BY DispositionDateTime ASC, TimesDispositioned ASC, LeadType ASC") or die(mysql_error());

If I remove any one of the three WHERE conditions, it works correctly. That doesn't work, I need all three...

Tips?

Old Pedant
10-31-2011, 08:41 PM
Never seen anything like that.



SELECT * FROM LeadTable
WHERE Operator = '$CurrentOp'
AND CallBackDateTime IS NULL
AND (LeadDisposition IS NULL OR LeadDisposition = 'NA' OR LeadDisposition = 'LM')
ORDER BY DispositionDateTime ASC, TimesDispositioned ASC, LeadType ASC

Is it possible there is no record that satisfies all three AND'ed conditions???

You could rewrite the last of those:

AND IFNULL(LeadDisposition,'NA") IN ('NA','LM')

I don't see why that would matter, but worth a shot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum