I have a table CUSTOMER_DETAIL with ID and BusinessDate columns. I will run a sql at 11.00 AM in the morning where i have to check if BusinessDate column has yesterday's date. if so pass it to my sql. If BusinessDate column doesnt have
yesterday's date then pass the MAX(BusinessDate) to the sql.
trying to figure how i can do that.
My sql is
select [ID],[BusinessDate] FROM CUSTOMER_DETAIL
where BusinessDate = (Here check if BusinessDate column has yesterday's date, if yes pass yesterdays date, it not then pass the MAX(BusinessDate)) .
Any idea how i can do that?
I know yesterdays date can be got using DATEADD(day, -1, convert(date, GETDATE()))
Any help will be greatly appreciated