Reputation: 45
This is so basic, i'm already sorry.
Where clause is: start date greater than 7/1/18 and end date is greater than 10/1/18 or is null
This where clause gets me what I need, but I'd rather use 'ISNULL' instead of OR.
WHERE l.[Start Date] > '07/01/2018' and (l.[End Date] > '10/1/2018' or l.[End Date] is null)
Can I say:
WHERE l.[Start Date] > '07/01/2018' and (l.[End Date] > ISNULL(l.[End Date]) or something?
Upvotes: 1
Views: 3885
Reputation: 164174
If you want isnull()
you can do it like this:
WHERE l.[Start Date] > '07/01/2018' and isnull(l.[End Date], '11/1/2018') > '10/1/2018'
If l.[End Date]
is null
then
isnull(l.[End Date], '11/1/2018')
will return
'11/1/2018'
and the condition
isnull(l.[End Date], '11/1/2018') > '10/1/2018'
will return true
.
Of course you can use instead any date like '1/1/2099'
Upvotes: 2