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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complicated append query

Status
Not open for further replies.

din2005

Programmer
Mar 22, 2005
162
GB
Hi all,

I would like to make append query which adds dates for the next 2 years but also adds slot 1 to 3. But does not include sundays.

basically a query that creates dates monday to saturday and each day has 3 slots.

e.g
DiaryDate Slots
19/02/2007 1
19/02/2007 2
19/02/2007 3

20/02/2007 1
20/02/2007 2
20/02/2007 3

21/02/2007 1
21/02/2007 2
21/02/2007 3

22/02/2007 1
22/02/2007 2
22/02/2007 3


etc

Could anyone give me an example to get me going?

Many thanks
 
I suggest you use a Calendar table that either flags or excludes holidays and weekends in conjunction with a Number table:

[tt]INSERT INTO tblAppendTo ( ApptDate, Slot )
SELECT tblCalendar.Calendar, tblNumbers.Slots
FROM tblCalendar, tblNumbers
WHERE tblNumbers.Slots<=3[/tt]
 
Thanks for replying,

how would i change this so it works with....

tblAppointments

and fields are DiaryDate and Slots

Also i don't want to exclude holidays or weekends now?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top