What I\'m trying to do is use more than one CASE WHEN condition for the same column.
Here is my code for the query:
SELECT Url=\'\',
I had a similar but it was dealing with dates. Query to show all items for the last month, works great without conditions until Jan. In order for it work correctly, needed to add a year and month variable
declare @yr int
declare @mth int
set @yr=(select case when month(getdate())=1 then YEAR(getdate())-1 else YEAR(getdate())end)
set @mth=(select case when month(getdate())=1 then month(getdate())+11 else month(getdate())end)
Now I just add the variable into condition: ...
(year(CreationTime)=@yr and MONTH(creationtime)=@mth)