쿼리3개를 합칠수는없나요? 0 2 1,086

by darkload [SQL Query] [2018.01.03 19:54:06]



 select full_name from cust_info
inner join item_chgo
on item_chgo.cust_code=cust_info.cust_code
where cust_info.cust_code= '0009'

select chgo_date,cust_code,item_code,chgo_qnty,chgo_dann,chgo_amnt
from item_chgo
where cust_code=(select  cust_code
				 from cust_info
				 where cust_code='0009')
				 
				
				 
select item_name from item_info
inner join item_chgo
on item_chgo.item_code=item_info.item_code
where item_chgo.item_code= '1801106'

각각의 쿼리를 하나로 합칠수는 없나요?

by 우리집아찌 [2018.01.03 20:37:05]

테이블 스키마,  샘플데이터 ,원하시는 결과물을 주세요.


by 마농 [2018.01.04 08:27:42]
SELECT a.chgo_date
     , a.cust_code
     , b.full_name cust_name
     , a.item_code
     , c.item_name
     , a.chgo_qnty
     , a.chgo_dann
     , a.chgo_amnt
  FROM item_chgo a
 INNER JOIN cust_info b
    ON a.cust_code = b.cust_code
 INNER JOIN item_info c
    ON a.item_code = c.item_code
 WHERE a.cust_code = '0009'
   AND a.item_code = '1801106'
;

 

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입