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 |
|
Ruther
Starting Member
1 Post |
Posted - 2007-01-08 : 12:28:27
|
| Hi,I have a table with data likedist | school | score------------------------100 | sch1 | Pass------------------------100 | sch2 | Fail------------------------101 | sch11 | Pass------------------------101 | sch123 | Fail------------------------103 | sch21 | PassMy problem is I want to write a query which should result likefor example a dist can have no of school's if any of the school'sscore is fail then entire dist score should be displayed as fail |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-08 : 12:34:27
|
| [code]-- prepare sample datadeclare @t table (dist int, school varchar(10), score varchar(10))insert @tselect 100, 'sch1', 'Pass' union allselect 100, 'sch2', 'Fail' union allselect 101, 'sch11', 'Pass' union allselect 101, 'sch123', 'Fail' union allselect 103, 'sch21', 'Pass'-- show the resultselect dist, min(score) scorefrom @tgroup by distorder by dist[/code]Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|
|
|