このmysqlクエリを変換する最良の方法を見つけようとしています
SELECT
SUM(invite.friendID = $mID AND invite.decidedwhen = '0000-00-00 00:00:00' AND evnt.ends >= '$event_ts' and invite.isactive = 0 and evnt.isactive = 0) AS invites_undecided,
SUM(invite.friendID = $mID AND invite.decidedwhen != '0000-00-00 00:00:00' AND invite.yes = 1 AND evnt.ends >= '$event_ts' and invite.isactive = 0) and evnt.isactive = 0 AS invites_yes,
SUM(invite.friendID = $mID AND invite.decidedwhen != '0000-00-00 00:00:00' AND invite.no = 1 AND evnt.ends >= '$event_ts' and invite.isactive = 0 and evnt.isactive = 0) AS invites_no,
SUM(invite.friendID = $mID AND invite.decidedwhen != '0000-00-00 00:00:00' AND invite.maybe = 1 AND evnt.ends >= '$event_ts' and invite.isactive = 0 and evnt.isactive = 0) AS invites_maybe
FROM user_event_invite AS invite
JOIN user_event AS evnt ON evnt.eID = invite.eID
Codeigniters アクティブ レコード フォーマットを使用するものに。例えば
$this->db->select()
->from('user_event')
->... something?
標準の mysql ステートメントは問題なく機能します。でも、何にでもこだわるという名目で現役のレコードを使いたい。これを行う方法はありますか?何も見つからないSUM()