채택완료

mysql 질문드립니다.

2017-06-22 (목) 15:34:55 2,573

8f4eb9b092669c7c3798f90388ae7621_1498113233_6655.png

test 테이블이라고 치고..

필드명 gu_code에 값이 없는애들만 찾아서 "-" 를넣어주고싶은데

타입이 varchar이거든요.. 어떻게 select해야할까요ㅠㅠ 

|

답변 2개

채택된 답변
+20 포인트
2017-06-22 (목) 15:46:50

select * from test where gu_code = '' or gu_code is null

이렇게 해서 빈값이 조회되는걸 확인하신후

update test set gu_code = '-' where gu_code = '' or gu_code is null

이렇게 하시면 될거 같습니다. 

2017-06-22 (목) 21:09:29

update test set gu_code = '-' where gu_code = '' or gu_code is null 

답변을 작성하려면 로그인이 필요합니다.