Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two columns one is having values and second one is null and i want to retrieve data for both columns using where condition please help
Posted
Comments
Nirav Prabtani 30-Jul-14 2:46am    
What is an issue??
Sharmanuj 30-Jul-14 2:48am    
give some more information regarding the desired output
tanugarg 30-Jul-14 2:51am    
i have two columns mode_pay and status_mode, mode_pay is having values and status_mode is null so i want to retrieve data from both columns like Select token_no from billentry where mode_pay= 'cash' and status_mode= 'null'

1 solution

You can try
SELECT * FROM myTable WHERE myTable.A = value OR myTable.B is null


An alternate approach is
SELECT * FROM myTable WHERE myTable.A = value 
UNION
SELECT * FROM myTable WHERE myTable.B is null
 
Share this answer
 
v3
Comments
tanugarg 30-Jul-14 2:57am    
table is same not diffrent
Abhinav S 30-Jul-14 3:02am    
In my examples above, table name is same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900