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 |
|
winza
Starting Member
2 Posts |
Posted - 2009-10-23 : 15:16:52
|
| I have written one store proc which has joins and gets data from other table will return some 1000 rows which has repetitve data .I need to remove these repetive rows..i tried distinct,copying data to temp table and display only distict rows and 'group by' nuthin worked out..is there any way to display one unique records..say for eg:id status24568 Pass0367 Fail24568 Fail0214 Pass24568 PassIf u notice this 24568 repeats 3 times and also i need to display if it has atleast one status :Pass that id i have to display it as pass not the other.Any help will be appreciated.Thanks |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-10-23 : 15:28:24
|
| Try this:This assumes that 'pass' and 'fail' are the only two possible status. if an id exists with a 'pass' then pass will be returned as status.select id, max(status) as statusfrom <yourTable>group by idBe One with the OptimizerTG |
 |
|
|
winza
Starting Member
2 Posts |
Posted - 2009-10-23 : 15:37:34
|
| TG Awesome!!!! that was really quick response and it worked as charm...Thank you so much!!!!!!!!!! |
 |
|
|
|
|
|