SQL query group by clause

Results 1 to 2 of 2

Thread: SQL query group by clause

  1. #1
    Join Date
    Dec 1969

    Default SQL query group by clause

    I have this sql query where I need to see the productid, qty and total price. My query works fine when I have only 2 columns but incorrect when I add more columns.like the one below. When po_lineitem_total was not present I got the correct result.<BR>Any help is appreciated.Thanks.<BR><BR>select product_id, sum(quantity) as TotalQty, po_lineitem_total<BR>from order<BR>group by product_id, cy_po_lineitem_total<BR>

  2. #2
    Join Date
    Dec 1969

    Default Just a typo...

    Look at your first line. You used "po_lineitem_total".<BR><BR>Look at your last line. You used "cy_po_lineitem_total".<BR><BR>The names *must* match.<BR><BR>

Posting Permissions

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