I have below an SQL query with getdate inside IN
as shown in example
Since IN
requires expression in quotes it will not work.
It will work with dynamic query, but is there any other way other than dynamic query ?
e.g.
PIVOT
(
SUM(Items)
FOR [ReceivedDate]
IN (select
CONVERT(char(10), GetDate(),126)
,CONVERT(char(10), GetDate()-1,126)
,CONVERT(char(10), GetDate()-1,126)
)
This is not working.