Database

특정 테이블에서 다른 특정 테이블로 업데이트 하기

vipDeveloper 2020. 5. 18. 10:36
반응형

DB 작업 시 특정 테이블에서 다른 특정 테이블로 필드를 업데이트를 하고 싶을 때

 

사용할 수 있는 방법, 쿼리

UPDATE 옮길_테이블 as tableA, 원본_테이블 as tableB 
SET tableA.stream_service_name = tableB.stream_service_name,
  tableA.provider_id = tableB.provider_id,
  tableA.stream_service_name = tableB.stream_service_name,
  tableA.backdrop_image = tableB.backdrop_image,
  tableA.streaming_title = tableB.streaming_title,
  tableA.streaming_sub_title = tableB.streaming_sub_title,
  tableA.streaming_count = tableB.streaming_count,
  tableA.streaming_description = tableB.streaming_description,
  tableA.data = tableB.data,
  tableA.status = tableB.status,
  tableA.update_date = tableB.update_date
WHERE tableA.조건_필드 = tableB.조건_필드 
반응형