insert into custom(
busi_num,
custom,
shortt,
ceo,
charge_person,
busi_condition,
item,
post_num,
addrone,
addrtwo,
tel,
fax,
homepage,
co_yn,
foreign_yn,
tax_yn,
country_eng,
country_kor,
special_relation,
trade_stop,
contract_period_s,
contract_period_e,
regi_info_man,
regi_info_date,
modi_info_man,
modi_info_date
)values(
#{busiNum,jdbcType=VARCHAR}
, #{custom,jdbcType=VARCHAR}
, #{shortt,jdbcType=VARCHAR}
, #{ceo,jdbcType=VARCHAR}
, #{chargePerson,jdbcType=VARCHAR}
, #{busiCondition,jdbcType=VARCHAR}
, #{item,jdbcType=VARCHAR}
, #{postNum,jdbcType=VARCHAR}
, #{addrone,jdbcType=VARCHAR}
, #{addrtwo,jdbcType=VARCHAR}
, #{tel,jdbcType=VARCHAR}
, #{fax,jdbcType=VARCHAR}
, #{homepage,jdbcType=VARCHAR}
, #{coYn,jdbcType=VARCHAR}
, #{foreignYn,jdbcType=VARCHAR}
, #{taxYn,jdbcType=VARCHAR}
, #{countryEng,jdbcType=VARCHAR}
, #{countryKor,jdbcType=VARCHAR}
, #{specialRelation,jdbcType=VARCHAR}
, #{tradeStop,jdbcType=VARCHAR}
, TO_DATE(#{contractPeriodS, jdbcType=VARCHAR}, 'MM/DD/YYYY')
, TO_DATE(#{contractPeriodE, jdbcType=VARCHAR}, 'MM/DD/YYYY')
, #{regiInfoMan,jdbcType=VARCHAR}
, SYSDATE
, #{modiInfoMan,jdbcType=VARCHAR}
, SYSDATE
)
이 쿼리랑
SELECT
a.factory as factory
, a.trade_bank as tradeBank
, a.account_num as accountNum
, b.busi_num as busiNum
FROM account a JOIN custom b
ON a.busi_num = b.busi_num
WHERE a.busi_num = #{busiNum,jdbcType=VARCHAR}
이 쿼리랑 뭔가 합치고 싶거든요
정확히는 insert에 account이 테이블을 조인하고 싶습니다...
방법이 있을까요...
INSERT VALUES() 대신
INSERT SELECT 구문 이용 가능합니다.
http://gurubee.net/lecture/1016
단순히 "합친다"라는 모호한 표현 보다는 뭘 어떻게 하고 싶은지 구체적으로 표현해 주세요.
INSERT ALL
http://gurubee.net/tags/INSERT%20ALL