mardi 12 juillet 2016

Select rows by applying whatever condition(if or case)

I have a set of records suppose below:

Id  Name  status  date

1    xx     1      2016-06-27 14:05:17.447
2    yy     2      2016-06-27 14:05:17.447
3    zz     1      2016-06-27 14:05:17.447
4    aa     2      2016-06-27 14:05:17.447
5    bb     2      2016-06-27 14:05:17.447

I want to select all the rows from above but for the rows who have status=1, i want to apply a condition that

select if status=1 and date<=getdate

How can I do that?

Aucun commentaire:

Enregistrer un commentaire