目前我能够在CodeIgniter中使用WHERE语句,如下所示: $builder = $db->table('mytable');$builder->where$params['some-param']); 我需要做的是一个WHERE语句,它只有在if语句为真时才适用。类似于: (IF gender = 'Male', apply these rows the f
, (hours from TableA if UseExternalinfo is 0, and from hours TableB if useextername) where不确定这是否有意义,我只是试图得到一个“where if”语句,如果存在这样的东西的话。谁能给我指个正确的方向,我怎样才能做到这一点。
谢谢
我使用这个MySQL代码Distinct(UserID) As User,(SELECT COALESCE(SUM(Amount),0) FROM Table2 WHERE UserID=User) AS Received,
((SELECTCOALESCE(SUM(Amount),0) FROM Table1 WHERE UserID=User) - (SELECT COAL