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: <sybrandb_at_hccnet.nl>
Date: Fri, 22 Jun 2007 00:01:06 +0200
Message-ID: <h6tl731sot5p7jjr29d3qpe8spn31h1223@4ax.com>


On Thu, 21 Jun 2007 14:30:04 -0700, justsomeschmuck_at_hotmail.com wrote:

>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

Regrettably it is quite clear the design is flawed, as the ordergrouptotal is denormalized.
You need to revise the design instead of starting to implement kludges like you describe above.

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Thu Jun 21 2007 - 17:01:06 CDT

Original text of this message

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