Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: newbie syntax question

Re: newbie syntax question

From: <justsomeschmuck_at_hotmail.com>
Date: Thu, 21 Jun 2007 14:30:04 -0700
Message-ID: <1182461404.575534.283260@p77g2000hsh.googlegroups.com>


On Jun 21, 2:51 pm, "Chris Colclough"
<chris.colclough_at_no_spam.jhuapl.edu> wrote:
> Distinct may not be needed.

In my case, the DISTINCT is needed for this reason...

The source table is Orders o. This table has many rows of unique OrderIDs. Any number of these order rows can be in the same OrderGroup, having the same OrderGroupID & OrderGroupTotal values. Thus to get back a rowset of unique OrderGroupIDs and their resepective totals, I need the DISTINCT keyword.

> Try the following to get a grand total as a repeating value in the last
> column:

that was something i had tried earlier, but its not quite right. the SUM will sum ALL instances of the OrderGroupTotal matching the WHERE clause (status = 2), whereas i only want to sum each distinct OrderGroup.

Thanks,

John Received on Thu Jun 21 2007 - 16:30:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US