묻고답하기
게시판 글을 쿼리해서 불러올때 데이터가 1건인 경우 오류
2019.05.15 10:16
{@
$oDB = &DB::getInstance();
// 기간별업무처리현황 통계 쿼리 //
$query = $oDB->_query('SELECT aa.VALUE2 AS "value2", aa.VALUE4 AS "value3", aa.VALUE5 AS "value4", bb.VALUE3 AS "value5", cc.VALUE3 AS "value6"
FROM (SELECT a.document_srl AS "VALUE1", c.title AS "VALUE2" , b.value AS "VALUE3" , (substring(a.title,1,20)) AS "VALUE4" , (substring(a.content,1,80)) AS VALUE5
FROM xe_documents a, xe_document_extra_vars b, xe_document_categories c
where a.document_srl = b.document_srl and a.module_srl = "67" AND c.category_srl = a.category_srl AND b.var_idx = "1" AND b.VALUE = curdate()) aa join
(SELECT a.document_srl AS VALUE1, b.VALUE AS VALUE3
FROM xe_documents a, xe_document_extra_vars b, xe_document_categories c
where a.document_srl = b.document_srl and a.module_srl = "67" AND b.var_idx = "2") bb ON aa.VALUE1 = bb.VALUE1 join
(SELECT a.document_srl AS VALUE1, b.VALUE AS VALUE3
FROM xe_documents a, xe_document_extra_vars b, xe_document_categories c
where a.document_srl = b.document_srl and a.module_srl = "67" AND b.var_idx = "3") cc ON bb.VALUE1 = cc.VALUE1
GROUP BY aa.VALUE1');
$result = $oDB->_fetch($query);
===============================================
<table border 2px>{@ $no = 1}
<th width="30px">{"구 분"}</th>
<th width="120px">{"업무구분"}</th>
<th width="200px">{"제 목"}</th>
<th width="450px">{"내 용"}</th>
<th width="60px">{"업무분류"}</th>
<th width="50px">{"처리상태"}</th>
<!--@foreach($result as $key => $val)-->
<tr>
<td align="center">{$no++}</td>
<td align="center">{$val->value2}</td>
<td align="center">{$val->value3}</td>
<td>{$val->value4}</td>
<td align="center">{$val->value5}</td>
<td align="center">{$val->value6}</td>
</td>
</tr>
<!--@end-->
</table>
위와같이 쿼리를해서 웹에 표출을 하려고 하는데 데이터가 1건인경우 표시가 안됩니다.
무엇이 문제인가요?
function executeQueryArray xe함수를 사용하면 가능하다는것같은데 어떻게 적용해야할지 모르겠어요...