[thelist] Query Help

Casey aspnet at thecrookstons.com
Thu Jan 5 12:07:03 CST 2006


Chris Wrote:

> 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 & "' "

Thanks Chris.... but, can you use a table in the WHERE clause when you 
didn't use it in the SELECT?  I now get this error:

~~~~~~~~~~~~~~~~~~~~~~~
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]The column prefix 
'events_banquets_staff' does not match with a table name or alias name used 
in the query.

/edit/work_schedule.asp, line 8
~~~~~~~~~~~~~~~~~~~~~

-- Original Message --

[snip]

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 & "' " 




More information about the thelist mailing list