| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Using DISTINCT AND SUM together SQL question
Hi All,
I've got a large table that I'm trying to write a query for. I don't fully understand the grouping functions, and I'm having some trouble getting what I want from the table. The table contains many columns but I am only interested in 3 of them. Call them ITEM, REV, and QTY. I (simply) want to do a SUM(QTY), but only for distinct rows of ITEM and REV. That is to say,
SELECT DISTINCT ITEM, REV FROM ...
and for that matter also
SELECT DISTINCT ITEM, REV, QTY FROM ...
both give me the rows I want. But how can I get SUM(QTY) for the whole
set?
TIA, Mia Received on Fri Apr 12 2002 - 14:37:56 CDT
![]() |
![]() |