Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2006

Tip: Looking for answers? Try searching our database.

SQL wizards

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JethroUK© - 03 Apr 2006 23:41 GMT
I'm quite good at queries, but i'm crap at agregate queries (counting) - I'm
trying to produce the simplest (i thought) list for the receptionist so she
doesn't overbook my classroom - the final list (my aim) includes just two
fields,

1 produces a list of future start dates from dates she has already booked
some people on to

2 produces a count of all clients already attending the class by session
(morning or afternoon) + all the ones she has booked to join it

e.g. :

 Query1 Start Date CountOfStart Date
     26/04/2006 11:30:00 18
     12/04/2006 15:30:00 16
     12/04/2006 11:30:00 16
     12/04/2006 11:30:00 18

i have managed to produce the correct list - but only after creating 3
queries and basing each one on the previous one:

1/ list ('bookings') of all current clients + clients booked in to start

SELECT CLIENTS.[Start Date], CLIENTS.Session
FROM CLIENTS
WHERE CLIENTS.[Start Date]>Now() OR CLIENTS.[L1 Enrolled] Is Not Null AND
CLIENTS.[L1 Submitted] Is Null OR CLIENTS.[L2 Enrolled] Is Not Null AND
CLIENTS.[L2 Submitted] Is Null;

2/ count of clients ('count') attending + booked onto a session

SELECT Count(bookings.[Start Date]) AS [CountOfStart Date], bookings.Session
FROM bookings
GROUP BY bookings.Session;

3/ a list of all future booking dates + counts from previous query

SELECT DISTINCT bookings.[Start Date], count.[CountOfStart Date]
FROM bookings INNER JOIN [count] ON bookings.Session = count.Session
WHERE bookings.[Start Date]>Now()
ORDER BY bookings.[Start Date] DESC;

i suspect these could be condensed into one simply query - but i cant figure
it - any clues?
[MVP] S.Clark - 04 Apr 2006 15:03 GMT
Many times I take the approach that you have in that I'll create 2 or more
queries to get the job done.  You can make queries with subqueries if you
like, but they're very difficult to debug.

Signature

Steve Clark, Access MVP
http://www.fmsinc.com/consulting
*FREE* Access Tips: http://www.fmsinc.com/free/tips.html

> I'm quite good at queries, but i'm crap at agregate queries (counting) -
> I'm
[quoted text clipped - 45 lines]
> figure
> it - any clues?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.