[thelist] Query Help
Casey
aspnet at thecrookstons.com
Wed Jan 4 18:05:11 CST 2006
Along the same lines, is it possible to select different sets from different
tables in the same query? For example:
SELECT (* FROM table1), (DISTINCT userID FROM table2) where table1.userID =
table2.userID and table2.userID = " & userID
If this is possible, what would be the correct syntax?
----- Original Message -----
From: "Casey"
> 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