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 |
|
eddie
Starting Member
45 Posts |
Posted - 2002-04-25 : 10:02:27
|
| I know I can use the min function to grab the minumum value a column but is there a fuction to grab the minimum value from two different columns?Ex. I have two values and I want to get the min one..This doesn't work but something like this:Declare @num1 intDeclare @num2 intSet @num1=1Set @num2=3Select min(@num1,@num2) I would want to return 1.Thanks,Eddie |
|
|
Onamuji
Aged Yak Warrior
504 Posts |
Posted - 2002-04-25 : 10:09:08
|
declare @x intdeclare @y intset @x = 1set @y = 3select min(val) from (select @x val union select @y val) as vals |
 |
|
|
|
|
|