!='1' Returning False on NULL Values

Mr.MoLa

New Member
I have two tables. \[code\]offers\[/code\] and \[code\]offer_status\[/code\]. I want to return rows from \[code\]offers\[/code\] where the \[code\]offer_status\[/code\] row is either missing or the \[code\]disabled\[/code\] column in that table is 0.Here is how I tried to do it:\[code\]SELECT offers.id,network,campid,name,url FROM offersLEFT JOIN offer_status ON offers.id = offer_status.sql_idAND offer_status.user_id='3'WHERE country='US'AND offer_status.disabled != '1'ORDER BY epc DESC LIMIT 7\[/code\]However, this does not work if the row in \[code\]offer_status\[/code\] does not exist (and the JOIN fails). To me, it seems like it should still work though since offer_status.disabled is null.This DOES work:\[code\]SELECT offers.id,network,campid,name,url FROM offersLEFT JOIN offer_status ON offers.id = offer_status.sql_idAND offer_status.user_id='3'WHERE country='US'AND (offer_status.disabled IS NULL OR offer_status.disabled=0)ORDER BY epc DESC LIMIT 7\[/code\]But to me this seems worse preformance-wise, and I am still disappointed my original thought didn't work.Is the OR statement above the only way to do this? Is there a better method?
 
Top