Total count

  • I need to sum each of 40 columns out of 42 then add them together to get a total with one SQL statement.

    Can you help?

    Here is what I have so far:

    SELECT SUM([index],[01],[02],...,[at]) FROM [count];

  • Quick thought, sum the addition of all columns

    😎

    SELECT

    SUM(TS.COL_001 + TS.COL_002 + TS.COL_003 + TS.COL_004 + TS.COL_005 + TS.COL_006 + TS.COL_007 + TS.COL_008 + TS.COL_009 + TS.COL_010) AS TOTAL_SUM

    FROM dbo.TBL_TO_SUM TS

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply