Update

DataBase/JOOQ

[JOOQ] Update 시, 조건에 따라 업데이트 컬럼을 추가. add update column by condition.

UpdateSetMoreStep 을 사용하면 된다. public void updateAccount(UserSession user, AccountDTO dto) { // Before DSL.update(ACCOUNT) .set(ACCOUNT.USER_NAME, dto.getUserName()) .set(ACCOUNT.ADDRESS, dto.getAddress()) .set(ACCOUNT.UPDATE_USER_ID, user.getId()) .where(ACCOUNT.ID.eq(dto.getAccountId())) .execute(); // After. apply UpdateSetMoreStep UpdateSetMoreStep updateSets = DSL.update(ACCOUNT) .set(ACCOUNT..

DataBase/SQL

[MySQL/SQL] update 시 테이블 조인. update table join.

update시 관련 테이블의 데이터를 이용하려면 아래와 같이 조인 하여 사용한다. update account a inner join account_order o on a.id = o.user_id set a.order_expiry_at = o.order_end_at WHERE o.current_status = 'ORDERFAILED' AND o.updated_at >= '2020-10-21' AND o.error_msg = 'no value present';