If you want to use that query: <cfoutput query="getEmployeeDetails" group="reference"> <option ... </cfoutput>
But why do you need to loop over the query, as you already know the reference is 'cfcoder' (it's in your query) You could also make a query to just get distinct refrences. Pascal > -----Original Message----- > From: cf coder [mailto:[EMAIL PROTECTED] > Sent: 20 October 2004 14:30 > To: CF-Talk > Subject: Select distinct record - help > > Hello everybody, > > I was wondering if someone could help me. I am trying to get the distinct > record from a select statment. Here is the code. > > <cfquery name="getEmployeeDetails" datasource="db"> > select distinct reference, uniqueID, firstname, lastname > FROM employee > WHERE reference = 'cfcoder' > ORDER BY reference asc > </cfquery> > > This brings back 2 records, and I want it to only return 1 row. > > <select name="custname" id="custname"> > <cfloop query="getEmployeeDetails"> > <option value="#reference#">#reference#</option> > </cfloop> > </select> > > The data in the table looks like this > > 1 cfcoder cf coder > 2 CFCODEr cf coder > > There are two rows in the table with the same reference. How do I get it > to only display 1 record. Can somebody please help > > Regards > cfcoder > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://www.houseoffusion.com/banners/view.cfm?bannerid=35 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:181983 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54