Results 1 to 3 of 3

Thread: SQL-Grouping?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    Hi guys, Is there a way whereby i could select all the content in the table when using group by??

    The code below works.
    Select CLAIMNO, Format(sum(NET),'######0.00') from export_comp GROUP BY CLAIMNO order by CLAIMNO asc

    But when I added (Vend_id & Clinic):
    Select CLAIMNO, Vend_id, Clinic, Format(sum(NET),'######0.00') from export_comp GROUP BY CLAIMNO order by CLAIMNO asc

    The following error message appears:
    "You tried to execute a query that does not include specified expression as part of an aggregate function".

    Thks & regards.

    I know that i could actually include the other content by adding them into group by, but I did not want that, so is there another way out??

    e.g.:
    Select CLAIMNO, Vend_id, Clinic, Format(sum(NET),'######0.00') from export_comp GROUP BY CLAIMNO, Vend_id, Clinic order by CLAIMNO asc



    [This message has been edited by SAMS (edited 10-08-1999).]

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Not in SQL. When GROUP BY is used, the items in the select statement must either be an aggregate or referenced by the group by (in the case of non-aggregates).

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    Ok, Thks.

Posting Permissions

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



Click Here to Expand Forum to Full Width