I have a large table (1 mio rows) and have this query:
Select ...,
case
when datediff(day,getdate())<30 then 'Month'
when datediff(day,getdate())<90 then 'Quater"
when datediff(day,getdate())<365 then 'YEAR'
else 'OLD' END
....
how do I prevent it from executing the function three times for each old row..??
I would love something like
case datediff(day,getdate())
when between 0 and 30 then 'month'
when between 31 and 90 then...