Q&A

댓글 8

  • document_srl 의 count가 0인 comment를 delete 하는 2중 select문을 쓰면 되겠네요
  • delete from xe_comments as comments where 0 <= (select count(*) as cnt from xe_documents as documents where comments.document_srl = documents.document_srl); 이렇게 쓰던가
  • @라라펠
    2중 select문에 대해서 검색하고 있었는데 설명해주셔서 정말 감사합니다
  • @비누
    실제 쿼리 실행 전에 select * from으로 제대로 잡히는지 꼭 확인하세요!
  • @라라펠
    select * from xe_comments as comments where 0 >= (select count(*) as cnt from xe_documents as documents where comments.document_srl = documents.document_srl)
    부등호가 반대로 되어서 고쳐서 하니 잘 됩니다. 라라펠님은 정말 최고세요
  • @라라펠
    게시글 삭제시에 exam 모듈같은 영향으로 정상적으로 삭제되지 않아

    /1231534 처럼 URL만 남아있고 메인으로 이동되는 현상도 혹시 쿼리문으로 체크해서 삭제해줄 수 있을까요?
  • @루딩
    예 가능할 것으로 사료됩니다.
  • 최종 삭제 구문은
    delete from xe_comments where 0 >= (select count(*) as cnt from xe_documents where xe_comments.document_srl = xe_documents.document_srl);
    이렇게 작동했습니다.