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...
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...
This is what you need:
SELECT * FROM table WHERE SubId='1' OR SubId IS NULL
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: