#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Laurens, SC ,US
    Posts
    20
    Rep Power
    0
    I would like to use the Sum function for a page which shows orders in the database.

    I use the following:

    "Select Location, (Sum)OrderTotal from Orders Group by Location"

    and get a very long string of numbers. The same phrasing works with Count but not with AVG or Sum.

    The OrderTotal field is decimal type.

    Does anyone know why this isn't working or have suggestions about getting a total?

    Thanks.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    10
    Rep Power
    0
    The Syntax is wrong, Sum should not be in brackets (I dont know if you meant to do this). The syntax should be:
    Select Sum(Order) instead.

    Apart from that - it should work fine.
    Make sure the column you are summing,
    is a number type.

Similar Threads

  1. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 17th, 2004, 12:21 AM
  2. sum function
    By rolandkenens in forum PHP Development
    Replies: 1
    Last Post: April 6th, 2003, 05:30 PM
  3. PosgreSQL installation error on windows
    By ggnanaraj in forum PostgreSQL Help
    Replies: 2
    Last Post: November 18th, 2002, 07:51 AM
  4. help with function for displaying calculation results
    By martincrumlish in forum PHP Development
    Replies: 0
    Last Post: October 4th, 2002, 04:34 AM
  5. Very odd results from array functions
    By etherwolf in forum PHP Development
    Replies: 5
    Last Post: December 7th, 2001, 05:02 PM

IMN logo majestic logo threadwatch logo seochat tools logo