-- get the max value per row of few columns of a table
SELECT StamTableStr, (SELECT MAX(val) FROM (VALUES(colIntA),(colIntB)) AS D(val)) AS mx FROM dbo.StamTable
-- Summarize the value of few columns of a table per row
SELECT StamTableStr, (SELECT SUM(val) FROM (VALUES(colIntA),(colIntB)) AS D(val)) AS sm FROM dbo.StamTable
No comments:
Post a Comment