try selecting e.firstname alone as well as everything else you have already
then add your order by e.firstname
SELECT DISTINCT(t.employeeid), e.firstname
e.firstname + e.lastname AS name
FROM transactions t
LEFT JOIN employees e ON t.employeeid = e.employeeid
ORDER BY e.firstname
</cfquery>
----- Original Message -----
From: "Jim McAtee" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 7:56 PM
Subject: Query How-To
> 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