dsrnu
asked on
Query Help - if(s.user_id <> NULL, 1, 0) not working as expected
I'm trying to make s.user_id return 1 if it's not null, otherwise return 0.. but my code below seems to be returning all zeroes.. any ideas?
'SELECT u.id AS user_id, u.username, if(s.user_id <> NULL, 1, 0) AS is_seller FROM ' . $this->user_table_name . ' u LEFT JOIN ' . $this->seller_table_name . ' s ON u.id=s.user_id'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER