Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Posts
    168

    Unanswered: Simple group by query

    I have a source data like this.



    Customer_ID Product Price Customer_Name Customer_Address
    001 1 30 John Smith
    001 2 50 John Smith
    ....

    Certainly, this table is not normalized, but that's how t he source data is like. But I want to do is to have total each customer sales with its details (name etc), for example:

    Customer_ID Price Customer_Name Customer_Address
    001 80 John Smith
    ....

    Does anyone know how to do this ? Thanks.

    Is it possible to have a customer table based on the source data ?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    select Customer_ID, sum(Price)
    , Customer_Name, Customer_Address
    from yourtable
    group by Customer_ID, Customer_Name, Customer_Address

    rudy
    http://rudy.ca/

Posting Permissions

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