Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returns records where date is on Saturday or Sunday

Status
Not open for further replies.

eerich

IS-IT--Management
Nov 2, 2003
124
US
I'm trying to develop a query to return records that have a creation date on Saturday or Sunday only. I've searched the forum but couldn't find anything that addressed how to get these results in SQL. The query I've written does not work:

SELECT formatdatetime(CreateDate,1) as EntryDate, day(createdate) as DayofWeek, month(createdate) as Month, year(createdate) as Year, VoucherNum, GLAcctNum
FROM Corp
Where Day(CreateDate) >5;

I was hoping that the where clause would allow me to pull back just Saturdays and Sundays but it doesnt work.

Any help is appreciated.
 
Shortly after posting, I figured out a solution. I added the following WHERE clause, which seemed to do the trick:

Where WeekDay(CreateDate) not between 2 and 6;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top