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
                                

Reply via email to