채택완료
sql 문에서 특정 카테고리글만 가져오려면 어떻게 해야할까요?
<?php $total = sql_fetch("select sum(wr_1) as sum_wr1 from $table where wr_is_comment='0'"); echo number_format($total[sum_wr1]) ?>
위 방법대로 하면 wr_1 필드의 값이 모두 더해져서 출력되는데요
조건을 걸어서 카테고리명이 yes 인 wr_1 필드의 값을 모두 더하려면 어떻게 해야할까요?
|
답변 1개 / 댓글 1개
채택된 답변
+20 포인트
2016-11-20 (일) 18:29:21
$total = sql_fetch("select sum(wr_1) as sum_wr1 from $table where wr_is_comment='0' and ca_name='yes' ");
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.