select t201.name 거래처, t123.name 대분류, t121.code 제품코드, t121.name 제품명, t121.model_no 모델명, t121.bar_code 바코드, t121.stock_cnt 현재고량, t121.std_stock_cnt 적정재고량, t201.code 거래처코드, t121.stock_price 매입가,t121.sale_price 판매단가, t121.standard_in 소박스, standard_out 대박스 from mall_t501_trade_product t501, mall_t121_product t121, mall_t201_company t201, mall_t123_category t123 where t121.company_code = t201.code(+) and t121.large_fraction = t123.large_fraction(+) and t121.eprise_code = t123.eprise_code and t121.end_date > '20141122' and t121.eprise_code = 2 ORDER BY t121.name
위 쿼리가 원래 쿼리입니다.
SELECT substr(trade_date,1,4)||'-'||substr(trade_date,5,2)||'-'||substr(trade_date,7,2) C0000매출일자, t201.name L0000매출처명, t121.name L0000제품명, t121.bar_code C0000바코드, to_char(decode(t500.trade_type,'202',-t501.cnt,t501.cnt),'999,999,999') R0000수량, to_char(t121.stock_price,'999,999,999,999') R0000매입단가, to_char(t501.buying_price,'999,999,999,999') R0000판매단가, to_char(decode(t500.trade_type,'202',-t501.cnt,t501.cnt)*t501.buying_price,'999,999,999,999') R0000합계금액 FROM mall_t201_company t201, mall_t121_product t121, mall_t501_trade_product t501, mall_t500_trade t500 WHERE t500.company_code = t201.code AND t501.product_code = t121.code AND t500.code = t501.trade_code AND t500.trade_type = '200' AND t500.trade_date between '20141022' AND '20141022' and t500.show_yn = 'Y' ORDER BY L0000제품명, C0000바코드, C0000매출일자, L0000매출처명
이게 두번째 쿼리문이에요..
그런데 1번째 쿼리문에 2번째 쿼리문중에 R0000수량과 AND t500.trade_date between '20141022' AND '20141022' 을 넣어서 조인해 보려는데 자꾸 에러만 나네요~~ ㅠㅠㅠ
mall_t501_trade_product t501, mall_t500_trade t500을 같이 조인해야 하는데 테이블을 5개만 조인하면 오라클이 다운되버리네요~~
오라클 초보라 한수 부탁 드려요 ㅠㅠ