[thelist] Query Help
thelist at cjmarsh.com
thelist at cjmarsh.com
Wed Jan 4 18:18:46 CST 2006
Casey
[..]
> 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?
The DISTINCT clause will be satisfied when the values of all fields listed
in the SELECT statement *combined* are unique. Thus the following will
return a list of all event ids, each being represented once.
SELECT DISTINCT events_banquets.event_id
WHERE events_banquets.event_id = events_banquets_staff.event_id
AND events_banquets_staff.userID = '" & userID & "' "
Regards
Chris Marsh
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.11/219 - Release Date: 02/01/2006
More information about the thelist
mailing list