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 |
|
DavisJ44
Starting Member
9 Posts |
Posted - 2009-02-19 : 10:28:08
|
| I'm new to SQL Server, but very familiar with DB2 and Oracle. In DB2 you can take the minimum of two values by the following:MIN(a,b)However, when I use this technique in SQL Server it says MIN only takes one argument and it tries to take the minimum of a column. What if I have two values in a single row and want to return the minimum of the two?Thanks in advance |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-19 : 10:29:37
|
| theres nothing in sql server for this. You'll have to use case statement. |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-19 : 10:30:44
|
Something like, case when a<b then a else ... end |
 |
|
|
DavisJ44
Starting Member
9 Posts |
Posted - 2009-02-19 : 10:43:04
|
| Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-19 : 11:24:51
|
orSELECT MIN(Val)FROM(SELECT a AS Val FROM TableUNION ALLSELECT b FROM Table)t |
 |
|
|
|
|
|