SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MSQL "Sum" problem 2 hours wasted to solve

    i wasted 2 hours trying to solve this, still trying.
    i will appreciate your help in this

    PHP Code:
    SELECT 

    sum
    ((price-discount) * (quantity+quantity_store))) AS TOTAL_SALES

    FROM 
    orders_items


    WHERE 
     
    date BETWEEN 
    '{$_GET['start_date']}' AND '{$_GET['end_date']}'

    ORDER BY date DESC 
    ------------------
    I GET THIS ERROR

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS TOTAL_SALES FROM orders_items WHERE date BETWEEN '2010-02-01' at line 3
    -----------------

    I need to know the total amount of the sales in a specific time

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Erm, you have one too many closing brackets. Change ))) to )) after quantity_store
    Sam Hastings

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you SJH, it was that simple but i did not notice it.


Bookmarks

Posting Permissions

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