delete 에서 inner join 수정좀 부탁합니다 채택완료
g5_write_test 게시판에
wr_content 내용에 test.com 포함되는
g5_board_file 의 wr_id 만 삭제하고싶습니다
밑에 잘못됬는데 어떻게 고침 되나요?
delete f from g5_board_file as f inner join g5_write_test as t on f.wr_id=t.wr_id where t.wr_content like '%test.com%';
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
7년 전
파일중에 test테이블에 글내용이 test.com이 존재하는 파일만 추출
</p>
<p>select a.* from g5_board_file a, g5_write_test b
where a.bo_table = 'test'
and b.wr_content like '%test.com%'
and b.wr_id = a.wr_id</p>
<p>
약간 확장
</p>
<p>select * from g5_board_file x</p>
<p>where exists(</p>
<p> select 'x' from g5_board_file a, g5_write_test b
where a.bo_table = 'test'
and b.wr_content like '%test.com%'
and b.wr_id = a.wr_id</p>
<p> and a.bo_table = x.bo_table
and a.wr_id = x.wr_id
and a.bf_no = x.bf_no)</p>
<p>
확장쿼릴 이용해서 삭제 적용
파일중에 test테이블에 글내용이 test.com이 존재하는 파일만 삭제
</p>
<p>delete from g5_board_file x</p>
<p>where exists(</p>
<p> select 'x' from g5_board_file a, g5_write_test b
where a.bo_table = 'test'
and b.wr_content like '%test.com%'
and b.wr_id = a.wr_id</p>
<p> and a.bo_table = x.bo_table
and a.wr_id = x.wr_id
and a.bf_no = x.bf_no)</p>
<p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
7년 전
DELETE f
FROM g5_board_file as f
INNER JOIN g5_write_test as t ON t.wr_id=f.wr_id
WHERE t.wr_content like '%test.com%';
별문제가 없어 보이는데요. 어떤 에러가 나오는지요?
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
�
7년 전
�
7년 전
DELETE f
FROM g5_board_file as f
INNER JOIN g5_write_test as t ON t.wr_id=f.wr_id AND f.bo_table='test'
WHERE t.wr_content like '%test.com%';
AND f.bo_table='test' 게시판명이 test인것중에 wr_id가 같은것을 찾아 삭제하면 안될까요?
FROM g5_board_file as f
INNER JOIN g5_write_test as t ON t.wr_id=f.wr_id AND f.bo_table='test'
WHERE t.wr_content like '%test.com%';
AND f.bo_table='test' 게시판명이 test인것중에 wr_id가 같은것을 찾아 삭제하면 안될까요?
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
채택
채택
답변대기
답변대기
채택
채택
채택
채택
채택
채택
채택
채택
답변대기
채택
답변대기
답변대기
채택
채택
답변대기
채택
제가 원하는것만 삭제되는게아니라
에러는 아니고 다른게시판 wr_id 까지 삭제되더라고요
g5_board_file 중에 다른 bo_table
그러니까 g5_board_file 다른게시판 g5_write_test2 의 동일한 wr_id 도 삭제되더라고요