ORDER BY name
+-----------------------------------------------+
Bryan Love
Macromedia Certified Professional
Internet Application Developer
Database Analyst
TeleCommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+
"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis
"Let's Roll"
- Todd Beamer, Flight 93
-----Original Message-----
From: Jim McAtee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 4:56 PM
To: CF-Talk
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
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4