View Full Version : How to get unique recordes using find_in_set
bhatupawar
Dec 18, 2009, 05:36 AM
Hi
I want to get unique records from the database. I am using disting function in select clause but I am not getiing proper output. How to get unique recordes using find_in_set ?
Please help me
crigby
Dec 18, 2009, 09:59 AM
Hi,
That only returns the first instance of a string; sounds like you need a different approach. See:
MySQL :: MySQL 5.1 Reference Manual :: 11.4 String Functions (http://dev.mysql.com/doc/refman/5.1/en/string-functions.html)
Peace,
Clarke
slapshot_oi
Dec 18, 2009, 11:25 AM
DISTINCT returns one record if two or more identical records in the result set exist; it's a dataset function, not a string function.
The primary key's job is to keep each record unique, and if your table doesn't have one, then DISTINCT should work provided each value of each field in each of the duplicate records are the same.
Are you trying to return a single record, or a result set of all unique records? Paste your SQL, it seems like what your trying to do is really basic.
ScottGem
Dec 18, 2009, 11:28 AM
DISTINCT should work, but only if the records are complete duplicates. It might help if you gave us info about your table structure and what is duplicated.