wr_id값이 채택완료
sIr어드민
3년 전
조회 1,601
코드 만지다가
wr_id값이 엉망이 되어
auto_incresment를 초기화하여 1부터 시작하게 했습니다.
잘되었는데
문제는 wr_num값과 wr_parent값은 그대로입니다..
이 wr_num을 새로 정렬한 wr_id에 준해서 다시 정리할 수 없을까요?
wr_parent값이 동일한거를 불러내고
그뒤 wr_id값이 낮은것에 맞추어 다시 wr_parent값을 부여한다던지..
wr_num값도 비슷한 방법으로 어떻게 할 수 없을까요?
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
3년 전
댓글은 없나요?
댓글이 아닌 글은 wr_id = wr_parent 입니다
댓글이 있으면 wr_id를 변경시켜버리면 안됩니다
wr_id 재설정해도 문제 없다면 나머지 변경 방법은 아래 쿼리 실행
sql_query("update 게시판 set wr_num = -1 * wr_id, wr_parent = wr_id ");
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
s
sIr어드민
3년 전
감사합니다. 코맨트 버려야할지 생각해봐야겠습니다.
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 2개
s
sIr어드민
3년 전
그렇군요,,,그런데 있던거도 1부터 시작하네요
�
엑스엠엘
3년 전
그럴 리가요.
https://dev.mysql.com/doc/refman/8.0/en/alter-table.html
한번 참고해 보세요.
You cannot reset the counter to a value less than or equal to the value that is currently in use. For both InnoDB and MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum AUTO_INCREMENT column value plus one.
https://dev.mysql.com/doc/refman/8.0/en/alter-table.html
한번 참고해 보세요.
You cannot reset the counter to a value less than or equal to the value that is currently in use. For both InnoDB and MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum AUTO_INCREMENT column value plus one.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인