Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008

    Unanswered: Division..Subtraction..Multiplication

    Hi Guys,

    I need to know how to do division, subtraction and multiplation within an CASE WHEN statement... below is my TSQL.

    CASE WHEN ColumnName IS NULL THEN 0 ELSE ((ColumnName1-ColumnName2)/ColumnName3)*100 END AS 'Alias'

    Please help

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    what do you need help with?

    you already are doing subtraction, division, and multilpication | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2008
    That's correct I am. Long story short, its been solved. I was using single quotes on column names, inturn treating them as literals. Also, I wasn't sure if thats how the math was done because it kept giving me errors.

    It works now though. Thanks for the reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts