Quantcast
Channel: conditions in where clause
Viewing all articles
Browse latest Browse all 5

conditions in where clause

$
0
0

Try the Below Query if you want only the records that have start date and end date as null for status other than that of CLSRM and all the records with CLSRM excepth those with null start date and end date

Select * from @tempTable 
where (status <> 'CLSRM' and strtdate is NULL and enddate is NULL) 
or (status = 'CLSRM' and strtdate is not NULL and enddate is not NULL)

the below query will give you the Records with status CLSRM without null values and the other rows with status not equal to CLSRM

Select * from @tempTable 
where (status <> 'CLSRM') 
or (status = 'CLSRM' and strtdate is not NULL and enddate is not NULL)


--------------------------------------------------------

Surender Singh Bhadauria

My Blog

 


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>