통계를 내는데, 카테고리부분이 적용이 안되고 있습니다. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

통계를 내는데, 카테고리부분이 적용이 안되고 있습니다. 정보

통계를 내는데, 카테고리부분이 적용이 안되고 있습니다.

본문

저의 의도는 AAA라는 그룹에 있는 각 게시판(카테고리가 모두 동일합니다.)에서 카테고리가 category_c 인 것을 뽑은 후에,
그중에서 wr_3 필드가 A인 경우, B인경우,C인경우 의 갯수를 뽑고자 하는 것입니다.

그런데 저의 의도와는 달리 결과물은,
AAA라는 그룹에서 카테고리 category_c가 들어있는 게시물이 있는 게시판을 뽑아서,
카테고리와는 상관없이 wr_3 필드가 A인 경우, B인경우,C인경우 의 갯수가 나옵니다.

고수님들께서 아래는 보시고 좋은 지도가 있기를 기다립니다.

----------------------------
 
<table cellpadding="0" cellspacing="0" class="table">
  <tr>
      <td class="subject1"><strong>이 름 </strong></td><td class="subject2"><strong> 갯수</strong></td>
  </tr>

<?
$wr_gr_id = 'AAA';
$wr_num_category = 'category_c';

$i = 0;
$j = 0;
$k = 0;
$sql = "SELECT bo_table, bo_subject FROM $g4[board_table] WHERE gr_id = '$wr_gr_id' order by bo_order_search asc ";
$qry = sql_query($sql);

for ($i=0; $row=sql_fetch_array($qry); $i++) {

  echo "<tr> <td class='num1' colspan='2'><strong> $row[bo_subject] </strong></td> </tr> ";

  $wr_bo_table = $row[bo_table];

  $sql2 = "SELECT * FROM g4_write_{$wr_bo_table} WHERE ca_name = '$wr_num_category'";
  $qry2 = sql_query($sql2);
 }
  for ($j=0; $row2=sql_fetch_array($qry2); $j++) {
 
      $sql3 = "SELECT wr_3, count(*) as count FROM g4_write_{$wr_bo_table} WHERE wr_3 = 'A' OR wr_3 = 'B' OR wr_3 = 'C' GROUP BY wr_3 ";
      $qry3 = sql_query($sql3);
     
        for ($k=0; $row3=sql_fetch_array($qry3); $k++) {   
       
            $wr_3_name = $row3[wr_3];
            $wr_3_count = number_format($row3[count]);

?>
<tr>
  <td class="num1"><strong><font color="#1AA9DE"><?=$wr_3_name?></font></strong></td>
  <td class="num2" align="right"><?=$wr_3_count?></td>
</tr>
<? } ?>
<? } ?>
</table>

( select a.* , ( select sum(co_count) as co_count from g4_qa_choose where mb_id=a.mb_id and bo_table = 'g4_qa' ) as q_co_count from `g4_write_g4_qa` a where wr_parent = '202335' and wr_8 != '' and wr_is_comment = 1 and CONVERT(wr_7, UNSIGNED) >= 5 group by wr_content having max(wr_7) order by CONVERT(wr_7, UNSIGNED) desc limit 3 )

1055 : Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sir.a.wr_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

error file : /15sir/bbs/board.php