PROJECT #10 - VIEW

aro9515·2022년 4월 25일
0

New Project

목록 보기
10/12

-- 물품입출고 내역을 이용한 재고수량

SELECT P.*, PC.* FROM PRODUCT P, (
    SELECT PRODUCT_NO, SUM(CNT) CNT FROM PRODUCTCOUNT GROUP BY PRODUCT_NO) PC 
WHERE P.NO = PC.PRODUCT_NO;
SELECT P.*, PC.* FROM PRODUCT P INNER JOIN (
    SELECT PRODUCT_NO, SUM(CNT) CNT FROM PRODUCTCOUNT GROUP BY PRODUCT_NO) PC 
ON P.NO = PC.PRODUCT_NO;    
CREATE OR REPLACE VIEW PRODUCT_VIEW AS
SELECT P.*, PC.* FROM PRODUCT P LEFT OUTER JOIN (
    SELECT PRODUCT_NO, SUM(CNT) CNT FROM PRODUCTCOUNT GROUP BY PRODUCT_NO) PC 
ON P.NO = PC.PRODUCT_NO;  
profile
The best

0개의 댓글