Remove the parens around t.employeeid ? DISTINCT applies to ALL columns requested, not just one. So DISTINCT can work correctly and return duplicate t.employeeid's (if there are dups in the data).
To get DISTINCT t.employeeid's, you'll have to run this query first: SELECT DISTINCT t.employeeid FROM transactions t LEFT JOIN employees e ON t.employeeid = e.employeeid best, paul At 05:56 PM 1/22/03 -0700, you wrote: >How can I go about ordering the following query by first name? > ><cfquery name="emp" datasource="#dsn#"> >SELECT DISTINCT(t.employeeid), > e.firstname + e.lastname AS name >FROM transactions t > LEFT JOIN employees e ON t.employeeid = e.employeeid ></cfquery> > >The following query throws an error about a conflict between the ORDER BY and >DISTINCT. > ><cfquery name="emp" datasource="#dsn#"> >SELECT DISTINCT(t.employeeid), > e.firstname + e.lastname AS name >FROM transactions t > LEFT JOIN employees e ON t.employeeid = e.employeeid >ORDER BY e.firstname ></cfquery> > >Thanks, >Jim > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

