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 for aggregate group by

Re: SQL for aggregate group by

From: Reinhard Wahl <Reinhard_nospam.Wahl_at_gmx.de>
Date: Mon, 3 Nov 2003 10:42:08 +0100
Message-ID: <bo57vm$182lns$1@ID-119204.news.uni-berlin.de>


Hi Robert,

I would try to use a inline view like this:

SELECT tn.item, tn.time, tn.qty
FROM table_name tn

         , ( SELECT item, max(qty) maxqty
             FROM table_name GROUP BY item) v
WHERE tn.item = v.item
AND tn.qty = v.maxqty;

I didn't test it, but it should be working in a similar way. Let me know if not, then I can check it by a real table.

Reinhard



For direct reply please remove _nospam from address Received on Mon Nov 03 2003 - 03:42:08 CST

Original text of this message

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