|
分類:[その他の言語]
select A.id,A.title,A.body,A.start_day,A.end_day,A.publish_flag, (case when (B.id is null or C.id is null) then A.iscolor = 1 else A.iscolor = 0 end) as iscolor from ( SELECT *, '' as iscolor FROM t_news ) as A left join ( SELECT id FROM t_news where CASE WHEN end_day IS NOT NULL THEN start_day <= current_date AND end_day >= current_date ELSE start_day <=current_date END ) as B ON A.id = B.id left join ( SELECT id FROM t_news where publish_flag = 1 ) as C ON A.id = C.id order by A.id desc limit 0,15
---上記のSQL文をzend 書き式で書きたいですがきけないです。 例: $select = $this->select() ->from($this->_name) ->where($strWhere) ->order($order) ->limit($count, $offset); $rowset = $this->fetchAll($select);
return array('data' => $rowset->toArray());
|