How to use Conditional where clause in Mysql?
Select * from table where SubId='1' and null
Is it right? I want to display records with subId=1 and rows with subId null
Any suggestion…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is what you need:
Unfortunately in English language, AND and OR can be used interchangeably in certain cases:
This is probably why you were trying to build your query with an ‘AND’. You may want to check the following Wikipedia article for further information about this problem: