Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
satheesh
Posting Yak Master
152 Posts |
Posted - 2011-09-29 : 11:01:55
|
| Dear All,I have a table which has emailaddress. I tried select row which has distict email.I used DISTINCT to select unique records.But not working.How to modify the below select query ?select distinct (emailaddress),cstid,cstname,title,firstname,lastname,postcodezipfrom tempReagrds,SG |
|
|
theboyholty
Posting Yak Master
226 Posts |
Posted - 2011-09-29 : 11:12:59
|
| SELECT DISTINCT will select those records where ALL the fields are unique. If you just want the unique emailaddresses, you'll need to use something like SELECT DISTINCT emailaddress FROM temp.If you've got an emailaddress field which appears three times, each with a different value for, say, cstid, your query will display all three records because they are all unique.---------------------------------------------------------------------------------http://www.mannyroadend.co.uk A Bury FC supporters website and forum |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-29 : 12:15:07
|
| if you want query to return unique emailaddress you will need to determine which associated values you need to return with the records. you can obviously return only one set of values for the other fields.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|