itsource

다른 ID로 여러 행을 동시에 업데이트

mycopycode 2023. 2. 6. 23:32
반응형

다른 ID로 여러 행을 동시에 업데이트

이런 일을 할 수 있을까요?

update table set field ='text' where ID=1 and ID=3 and ID=5

실행했지만 행이 업데이트되지 않았습니다.

당신은 필요하다IN보다는AND:

update table set field ='text' where ID IN (1, 3, 5)

아래와 같이 WHERE 뒤에 IN을 사용하실 수 있습니다.

update table set field ='text' where ID in (1, 3, 5)

SQL에서 일부 데이터 수집을 전달하고 싶다면 IN 키워드를 사용할 수 있습니다.

update table set field ='text' where ID in (1, 2,3,4,5,6,7);

언급URL : https://stackoverflow.com/questions/56431813/update-multiples-rows-with-different-id-at-the-same-time

반응형