[thelist] Query Help

Casey aspnet at thecrookstons.com
Wed Jan 4 17:57:39 CST 2006


In Classic ASP using MS SQL...

In English, here's what we need:  A banquet employee of a hotel can look at 
his work schedule online. Table "events_banquets" contains only the banquet 
events, one row per.  Table "events_banquets_staff" contains one row per 
employee per position.  (A third table contains positions: setup, server, 
cleanup, bar tender, event manager, host, etc.)  One employee could work 
multiple positions per event, thus it's possible that in 
"events_banquets_staff" there may be multiple lines for one employee per 
event.

But, when an employee wants to view the events he is scheduled to work, we 
only need to list each of his events once, even if is slated to work 
multiple positions at that event.  Make sense so far?

This query, which I thought would work, returns multiple records when an 
employee works multiple positions at the same event.

sql= "SELECT DISTINCT * FROM events_banquets, events_banquets_staff WHERE 
events_banquets.event_id = events_banquets_staff.event_id AND 
events_banquets_staff.userID = '" & userID & "' "

What do I need to do so that only one row per event is listed?

Many thanks in advance,

Casey 




More information about the thelist mailing list