Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mdixon44
Starting Member
26 Posts |
Posted - 2009-01-13 : 13:12:39
|
| Create a calendar showing all the weekends (Saturday and Sunday) for a two month period after your next birthday. List these date in a format such as june 5, 2025. In a second column, put the abbreviation of the day, Sat or Sun. Put one blank line between the weeks.Following the steps to successfully complete this taskStep 1 create the tablecreate table WkendCal(start_date datetime,end_date datetime);insert into WkendCalvalues (#01-MAR-2009# , #01-JUN-2009#);Step 2 Create the table containing all the consecutive daysselect n,cdate(start_date + n) as date_1into WkendCalfrom number_0_to_99,where start_date + n < end_date;Now step 3 is the one that I can not figure out. How do I delete all of the days and just leave Saturday and Sunday. If anyone can assist me on this one, I would appreciate it. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-01-13 : 14:59:31
|
| Not sure of the exact Access syntax, this is a MS SQL Server forum, but rather than delete the recs, justselect the ones you wantSELECT *From WkendCalWHERE Weekday(yourDate) = 1 or Weekday(yourDate) = 7Jim |
 |
|
|
|
|
|