create total record in html email

  • THis is where I believe I need to make a change to get into the Description and the Column totals..

    concat(', coalesce(sum(Case When ft.Entity = ', h.Entity, ' Then ft.total End), 0) As td, ''''')

    Trying o insert into different section of the statement with no luck.

    Thanks.

     

  • Bruin wrote:

    THis is where I believe I need to make a change to get into the Description and the Column totals..

    concat(', coalesce(sum(Case When ft.Entity = ', h.Entity, ' Then ft.total End), 0) As td, ''''')

    Trying o insert into different section of the statement with no luck.

    Thanks.

    Correct - wrap the full statement using format.  The full statement does not include the leading comma - or the column alias portion.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Got it...

    cast((Select concat(', Format(coalesce(sum(Case When ft.Entity = ', h.Entity, ' Then ft.total End), 0),''C'', ''en-US'' ) As td

    Thanks again...

  • Now - I would add the column alignment and format the generated SQL so it is easier to read.  If you don't care if the data is aligned in the columns then it isn't necessary - but I would recommend a right aligned column for decimal/money values.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 4 posts - 31 through 33 (of 33 total)

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