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 |
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-06-12 : 05:38:14
|
| Name Racesatish a rahul b sujan a satish c vivek d vivek a kishore a From the above data, i want to retrive the records only belongs to Race 'a' but not others. i.e for example. kishore should be output for race a. satish shouldn't be, bcz it belongs to other races also.How can i write a query to retive the records specific to one race. The names should not exist in other race.Name RaceG. Satish |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-12 : 05:51:38
|
quote: Originally posted by satish.gorijala Name Racesatish a rahul b sujan a satish c vivek d vivek a kishore a From the above data, i want to retrive the records only belongs to Race 'a' but not others. i.e for example. vivek should be output for race a. satish shouldn't be, bcz it belongs to other races also.How can i write a query to retive the recors specific to one race. The names should not exist in other race.
Vivek is a bad choice, because he competes in d as well as race a. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-12 : 05:52:15
|
SELECT Name, MAX(Race) FROM Table1 GROUP BY Name HAVING COUNT(*) = 1 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-06-12 : 06:00:11
|
Sorry, i made a mistake in requirement posting. Actually my requiremnt is i want to retrive the data based on the race column. If i want to retrive the data where race is 'a' means, it retrives all the records only exists in a. i.e kishore,sujan is only the ouput from the table. vivek & satish also belongs to race 'a'. but they both belongs to another race also. I need query for this..quote: Originally posted by Peso
quote: Originally posted by satish.gorijala Name Racesatish a rahul b sujan a satish c vivek d vivek a kishore a From the above data, i want to retrive the records only belongs to Race 'a' but not others. i.e for example. vivek should be output for race a. satish shouldn't be, bcz it belongs to other races also.How can i write a query to retive the recors specific to one race. The names should not exist in other race.
Vivek is a bad choice, because he competes in d as well as race a. E 12°55'05.63"N 56°04'39.26"
G. Satish |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-12 : 06:02:33
|
I did!Check the solution posted 06/12/2009 : 05:52:15 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-06-12 : 06:12:16
|
Thank You... I got it.quote: Originally posted by Peso I did!Check the solution posted 06/12/2009 : 05:52:15 E 12°55'05.63"N 56°04'39.26"
G. Satish |
 |
|
|
|
|
|
|
|