September 3, 2008 at 1:01 am
create table #MaxCal ( Col1 int ,Col2 int ,Col3 int)
insert into #MaxCal select 12 ,53,65
insert into #MaxCal select 54,67,43
insert into #MaxCal select 12,67,35
select * from #MaxCal
i want MAX value row wise for every row...
please help
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
September 3, 2008 at 2:18 am
This will work:
create table #MaxCal ( Col1 int ,Col2 int ,Col3 int)
insert into #MaxCal select 12 ,53,65
insert into #MaxCal select 54,67,43
insert into #MaxCal select 12,67,35
Select
Case
When Col1 >= Col2 and Col1 >= Col3 Then Col1
When Col2 >= Col3 Then Col2
Else Col3
End as max_row_value
From
#MaxCal
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
September 3, 2008 at 3:08 am
Thanks :):)
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply