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 |
|
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2006-07-11 : 15:17:35
|
| guys,I have table with empid having following valuesempid________123-1-2I want to write a query which returns me min(positive ID values)which in above case is 1is there any way we can do this sql server Thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-11 : 15:20:58
|
| SELECT MIN(empid)FROM YourTableWHERE empid > 0Tara Kizeraka tduggan |
 |
|
|
PSamsig
Constraint Violating Yak Guru
384 Posts |
Posted - 2006-07-12 : 01:40:40
|
| [code]SELECT MIN(CASE WHEN impid > 0 THEN empid END)FROM YourTable[/code]-- This one's tricky. You have to use calculus and imaginary numbers for this. You know, eleventeen, thirty-twelve and all those. |
 |
|
|
|
|
|