mysql 필드에 쿼리넣기
글쓴이: kid1402 / 작성시간: 목, 2012/05/10 - 6:37오후
제목 그대로 필드에 쿼리를 넣는게 가능한가요?
Comment 라는 테이블과 Footnote라는 테이블이 있고
Comment 에는 c_id, f_cnt가 있으며 c_id가 고유의 auto_increment 값입니다.
Footnote에는 f_id 와 c_id 가 있으며 f_id가 고유의 auto_increment값, c_id는 Comment의 c_id값들 중 하나입니다
이 상태에서 Comment의 f_cnt라는 필드에 다음과 같은 쿼리를 넣고싶습니다
select count(*) from Footnote where c_id = this.c_id ; <- 여기서 this는 Comment, c_id는 Footnote가 될거 같은데.. 맞나요?
이런 식의 쿼리를 필드에 넣을 수 도 있나요?
이 방법이 안되면 일일이 php 파일에서 수정될때마다 쿼리를 날려주는 방법 말고는 없나요?
Forums:
댓글 달기