cfdeveloper
Programmer
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
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