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 |
JoeMa
Starting Member
5 Posts |
Posted - 2009-01-21 : 15:48:26
|
Hi,I've got the following riddle and I don't get it :Table:c1 c2======17 117 43 717 65 9 The wanted result:Every c1 which has only c2's > 5The example above should therefor provide the result:c1====35Is it possible with SQL? Thx in advance bye,JoeMaedit: typos |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
JoeMa
Starting Member
5 Posts |
Posted - 2009-01-21 : 16:00:18
|
Thx for your answer.Maybe I was unclear.I'll try to describe what I need:If a row has c2 <= 5 at least one time then don't put any rows to result with the corresponding c1 of that row.Hope it's more uncerstandable? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-21 : 16:38:51
|
Since only c1 is used in the output, you can use the simplerSELECT c1 FROM YourTable GROUP BY c1 HAVING MIN(c2) > 5 E 12°55'05.63"N 56°04'39.26" |
|
|
JoeMa
Starting Member
5 Posts |
Posted - 2009-01-21 : 16:53:18
|
Both solutions work.Thank you very much |
|
|
|
|
|