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 |
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2012-07-31 : 11:23:36
|
I am doing nowselect * from registration r left join accesstype a on r.type=atypenow it's giving me all records from r but if there are 2 matching records in a then it gives me the record twice from rhow can i have it do it but only giving me 1 record from r (I thought left join was supposed to do that but it doesn't seem to be working) |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-31 : 11:53:57
|
[code]select distinct r.* from registration r left join accesstype a on r.type=atype[/code]if you want fields from a you need to apply some aggregation over them like SUM(),MIN(),MAX() etc to void duplicating r table values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|