A
angel75
Hi, I am setting up loans database with a table holding all the dates that
items are going in/out. I want to be able to ask user for the dates and
search the table for an item which is free between the two dates.
eg phone 2 is booked on 1/11, so when I enter 1/11 as start and end date I
want it to bring back phone 1/3/4. It is excluding the one entry where phone
2 is booked on that day, although it brings back all other entries for phone
2, and its also bringing back phone 1/3/4 future bookings, which is correct.
I am using Not Between StartDate and EndDate. What else do I need to do to
ensure if its checked phone 1 and its booked to exclude that phone
altogether? I am not good with SQL so want to keep it simple if possible.
SchedId ResourceId StartDate EndDate User Booked CheckedOut Completed
1 PHONE1 15-Jan-08 15-Jan-08 Sarah
yes
2 PHONE1 10-Sep-08 12-Sep-08 Vicki
yes
5 PHONE2 13-Oct-08 14-Oct-08 Fred
yes
4 PHONE2 17-Oct-08 17-Oct-08 John yes yes
no
3 PHONE1 20-Oct-08 20-Oct-08 Steve yes
no
15 PHONE2 01-Nov-08 16-Nov-08 Jack yes
no
11 PHONE2 19-Nov-08 25-Nov-08 Steve yes
no
7 PHONE1 22-Nov-08 22-Nov-08 John yes
no
17 PHONE1 01-Dec-08 01-Dec-08 Jan yes
no
Any help greatly appreciated!
items are going in/out. I want to be able to ask user for the dates and
search the table for an item which is free between the two dates.
eg phone 2 is booked on 1/11, so when I enter 1/11 as start and end date I
want it to bring back phone 1/3/4. It is excluding the one entry where phone
2 is booked on that day, although it brings back all other entries for phone
2, and its also bringing back phone 1/3/4 future bookings, which is correct.
I am using Not Between StartDate and EndDate. What else do I need to do to
ensure if its checked phone 1 and its booked to exclude that phone
altogether? I am not good with SQL so want to keep it simple if possible.
SchedId ResourceId StartDate EndDate User Booked CheckedOut Completed
1 PHONE1 15-Jan-08 15-Jan-08 Sarah
yes
2 PHONE1 10-Sep-08 12-Sep-08 Vicki
yes
5 PHONE2 13-Oct-08 14-Oct-08 Fred
yes
4 PHONE2 17-Oct-08 17-Oct-08 John yes yes
no
3 PHONE1 20-Oct-08 20-Oct-08 Steve yes
no
15 PHONE2 01-Nov-08 16-Nov-08 Jack yes
no
11 PHONE2 19-Nov-08 25-Nov-08 Steve yes
no
7 PHONE1 22-Nov-08 22-Nov-08 John yes
no
17 PHONE1 01-Dec-08 01-Dec-08 Jan yes
no
Any help greatly appreciated!