themoon
06-23-2008, 09:03 AM
Hi
I have this query the fetches all records which have not been updated since the last 2days. I am having schedule task that sends email for those records.
now, here is the trick, how can i exclude weekends from the query if the weekends is on Thursday & Friday ?
SELECT *,DATEDIFF(day, date_recorded, getdate()) AS no_of_days
FROM tablename
WHERE DATEDIFF(day, date_recorded, getdate()) <= '2'
date_recorded is a field name in my table.
Thanks
M
I have this query the fetches all records which have not been updated since the last 2days. I am having schedule task that sends email for those records.
now, here is the trick, how can i exclude weekends from the query if the weekends is on Thursday & Friday ?
SELECT *,DATEDIFF(day, date_recorded, getdate()) AS no_of_days
FROM tablename
WHERE DATEDIFF(day, date_recorded, getdate()) <= '2'
date_recorded is a field name in my table.
Thanks
M