SUM function two different fields in one table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jhayes7781
    New Member
    • Mar 2007
    • 9

    #1

    SUM function two different fields in one table

    I am trying to add the values of two fields in one table. Not sure how to get the SUM function to make this work.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    For each row:
    Code:
    SELECT fielda+fieldb AS Total FROM table;
    for total table:

    Code:
    SELECT SUM(fielda)+SUM(fieldb) AS Total FROM table,
    Ronald :cool:

    Comment

    • jhayes7781
      New Member
      • Mar 2007
      • 9

      #3
      How do I work this into other criteria that will sort on other unique fields?

      Comment

      • jhayes7781
        New Member
        • Mar 2007
        • 9

        #4
        N/M that last post...I got it.

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Glad to be of help. See you next time.

          Ronald :cool:

          Comment

          • parallax
            New Member
            • Apr 2007
            • 10

            #6
            Hi guys,

            i have the same problem but the fields are in a diffenret table, could u help me please????

            Comment

            • parallax
              New Member
              • Apr 2007
              • 10

              #7
              sorry, i forgot tell that i have to check the name as well before sum the values...

              thanks


              Danylo

              Comment

              Working...