Forum Replies Created

Viewing post 1 (of 1 total)

  • RE: GREATEST and LEAST function

    Another solution also using CROSS APPLY

    SELECT MyTable1.x, MyTable2.y,..., G.Greatest

    FROM MyTable1

    JOIN MyTable2 ON MyTable1.key = MyTable2.key

    .

    .

    CROSS APPLY (

    SELECT MAX(T.v) AS Greatest

    FROM ( VALUES (MyTable1.value), (MyTable2.value), ... ) AS T(v)

    ) AS...

Viewing post 1 (of 1 total)