MAXvaluerow wise

  • 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;-)

  • 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

  • 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