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
$total = sql_fetch("select sum(wr_1) as sum_wr1 from $table where wr_is_comment='0' and ca_name='yes' ");
답변을 작성하시기 전에 로그인 해주세요.