SQL - Selecting Weekdays in Period

Results 1 to 2 of 2

Thread: SQL - Selecting Weekdays in Period

  1. #1
    Join Date
    Dec 1969

    Default SQL - Selecting Weekdays in Period

    I have a SQL 2000 table of logins (attendence). How do I structure the following: "SELECT login_employee, login_datetime FROM tblLogins WHERE login_datetime NOT IN (all weekdays in a certain period of time)"...<BR><BR>i.e. I want to see who was ABSENT during the week for a given period of time.<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default Ok Don't have time to do much on this

    But In SQL Server you have <BR>Datepart(dw, &#060;some date&#062;)<BR><BR>so if you create a table of all "Dates" for you time period<BR><BR>Then <BR>Select login_employee, timeperiod From (<BR>SELECT login_employee, login_datetime, timeperiod FROM tblLogins, Timeperiodtable where datepart(dw, timeperiod) between 2 and 6)<BR>Where login_datetime is null<BR><BR>This is completely untested!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts