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 |
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-06 : 07:53:17
|
| Im Working with stored procedure. How can i compare Columns with specific values. I want to get the greater values of those column and inserted it to other columns. i want something like theseCASE WHEN a> b,c,d THEN a WHEN b> a,c,d THEN b WHEN c> a,b,d THEN c WHEN d> a,d,c THEN dis there any ways to implement this? i got an error.. thanks please help.. |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2008-02-06 : 08:34:22
|
| select max(a), max(b), max(c), max(d) from table |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-06 : 08:48:22
|
| [code]select case when a>b and a>c and a>d then a when b>c and b>d then b when c>d then c else d endfrom your_table[/code]MadhivananFailing to plan is Planning to fail |
 |
|
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-06 : 22:44:44
|
Thanks i do appreciate it a lot.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-07 : 07:09:24
|
quote: Originally posted by Limuh Thanks i do appreciate it a lot..
Which one?MadhivananFailing to plan is Planning to fail |
 |
|
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-12 : 22:23:23
|
| yours madhivanan |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
Limuh
Yak Posting Veteran
94 Posts |
Posted - 2008-02-13 : 02:56:51
|
| Thanks |
 |
|
|
|
|
|