Preap San
Preap San

Reputation: 13

How to select mysql with and or in one single sql statment

I want to select All Record from my table where referal = 0 and 1 and pos_left=NULL OR pos_right=NULL

Can anyone help me provide sql please. Table Record

Upvotes: 0

Views: 26

Answers (1)

Eugene Bartosh
Eugene Bartosh

Reputation: 324

SELECT * from your_table 
WHERE referral IN (0,1) 
AND ( ( pos_left IS NULL ) OR ( pos_right IS NULL ) )

Problem with logical expressions: field referal cannot be = 0 and 1, like human being is always man OR woman and cannot be man AND woman ;-)

Upvotes: 1

Related Questions