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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL query

Re: SQL query

From: Valentine Gogichashvili <valgog_at_biofrontera.de>
Date: Mon, 10 Mar 2003 17:03:52 +0100
Message-ID: <3e6cb7d8$1@news.piro.net>


You have to use the "group by" construct and inside your query have something like this:

( select SUM(qty), LOT from THETABLE group by LOT ) and then bind this table with the original one as you like.

Or if everything but the QTY is the same in the grouping column, then you can group by all the fields but QTY, and directly get your result, but this kind of table structure should never occur, move the QTY (and maybe DATE) to another table, and it will make it easier to manipulate the data.

Respectfully,

Valentine Gogichashvili

"Elena" <quan.e_at_neologistica.it> wrote in message news:b4hpe0$mfc$1_at_lacerta.tiscalinet.it...
> Hi,
> I have a table1 like this:
>
> DATE PACKING LIST ITEM CODE QTY LOT DESCRIPTI
> 24-FEB-03 211011290OP 21140320011 7 23408
...
> 24-FEB-03 211011290OP 21140320011 2 23410
...
> 24-FEB-03 211011290OP 26340791011 5 23408
...
> 24-FEB-03 211011290OP 26340791011 2 23408
...
> 27-FEB-03 21108433 26247383011 6 29510
> ...
> 27-FEB-03 57840320058 20143344011 3 29510
> ...
> 27-FEB-03 57840320058 20143344011 10 29510
>
>
> I would like to have the following OUTPUT from a query which I'm not able
to
> write.
>
> DATE PACKING LIST ITEM CODE QTY LOT
> 24-FEB-03 211011290OP 21140320011 7 23408
> 24-FEB-03 211011290OP 21140320011 2 23410
> 24-FEB-03 211011290OP 26340791011 7 23408
> 27-FEB-03 21108433 26247383011 6
> 29510
> 27-FEB-03 57840320058 20143344011 13 29510
>
> In a few words: I should obtain for the same date, packing-list, item code
> and lot the amount of quantity.
>
> Can anyone help me?
>
> Thanks in advance.
>
> Elena
>
>
>
>
>
Received on Mon Mar 10 2003 - 10:03:52 CST

Original text of this message

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