| MySQL - How to get DISTINCT or UNIQUE ? How to get the 4th field to be DISTINCT among 4 fields? |
bgb76

msg:4488533 | 1:35 am on Aug 27, 2012 (gmt 0) | Hi Masters, I'm facing this delima that among 4 fields, I want the 4th field to be DISTINCT. How? cno cfname cphone cemailid -- DISTINCT select DISTINCT cemailid, cno,cfname,cphone from rform (not working) Kindly help me, Please... Thanks in Advance. Bharadwaj
|
brotherhood of LAN

msg:4488538 | 2:05 am on Aug 27, 2012 (gmt 0) | This should work, SELECT select cemailid, cno,cfname,cphone FROM rform GROUP BY cphone See [dev.mysql.com...]
|
bgb76

msg:4488542 | 2:16 am on Aug 27, 2012 (gmt 0) | Thank You Bro, No avail. I tried. 544 records on distinct on "cemailid" after adding another field, the record shoot upto 612. Still trying. Thanks for help.
|
brotherhood of LAN

msg:4488543 | 2:31 am on Aug 27, 2012 (gmt 0) | GROUP BY field will most definitely give you distinct values. Maybe you should check for trailing newlines & spaces in those fields.
|
staceybrown281

msg:4495742 | 12:56 pm on Sep 16, 2012 (gmt 0) | Better use Group by Syntax that using the keyword DISTINCT.
|
Dijkgraaf

msg:4500008 | 4:17 am on Sep 26, 2012 (gmt 0) | bortherhood of LAN is right in principle, but wrong in detail ;-), if you want to be distinct on cemailid you need to group on cemailid SELECT select cemailid, cno,cfname,cphone FROM rform GROUP BY cemailid
|
|
|