Home > database >  Rookie help oracle packet statistical problems
Rookie help oracle packet statistical problems

Time:09-25

At the moment, I found out the data is

How to achieve this?

Bosses come quickly, thank you for your bosses ~

CodePudding user response:

The first picture sent you a wrong, resend the first picture, and attached SQL


SQL:
SELECT
GROUP_NAME,
DOC_DATE,
DOC_ID
PRODUCT_ID,
PRODUCT_NAME,
The SUM (QUANTITY) AS QUANTITY,
DW
The FROM
(
SELECT
RD., DOC_ID
RI FACILITY_ID,
RI PRODUCT_ID,
PRO. PRODUCT_NAME,
RI. PRICE,
RI. QUANTITY * DECODE (
RI UNIT_QUANTITY,
NULL,
1,
0,
1,
RI. UNIT_QUANTITY
) AS QUANTITY,
RD. DOC_DATE,
RC VENDOR_ID,
PG. GROUP_NAME,
SBT. The DESCRIPTION AS DW
The FROM
RECEIVE_DOC RD
INNER JOIN RECEIVE_ITEM RI ON RD., DOC_ID=RI. DOC_ID
INNER JOIN RECEIVE_COMMAND RC ON RD., BASE_ENTRY=RC. DOC_ID
LEFT the JOIN the PRODUCT PRO ON RI. The PRODUCT_ID=PRO. PRODUCT_ID
LEFT the JOIN SHIPMENT_BOX_TYPE SBT ON PRO. DEFAULT_SHIPMENT_BOX_TYPE_ID=SBT. SHIPMENT_BOX_TYPE_ID
LEFT the JOIN PARTY_GROUP PG ON PG. PARTY_ID.=RC VENDOR_ID
WHERE
1=1
AND RD. MOVEMENT_TYPE_ID='IC'
)
GROUP BY
GROUP_NAME,
DOC_DATE,
DOC_ID
PRODUCT_ID,
PRODUCT_NAME,
DW

CodePudding user response:

Rank () over ()
  • Related