Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012

    Unanswered: related fields in one single table/query

    There is a table with fields: ID, “employee name”, “amount”, “amount type: expense/income” and “date”. On the fourth field we can choose the amount type if it is an expense or income. At the end, we want to sum up all the amounts. Is there a function that we can make the amount number on the third field to be negative or positive based on our selection on the fourth field? For example if the amount is 200 and the forth field is expense it will be calculated as to be -200, but if the fourth field is income it will be +200.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada

    please show a few rows of sample data | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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