我正在使用 ZEND,我无法将以下查询转换为zend_db
选择对象格式:
SELECT *,CASE WHEN @score != score THEN @rank := @rank + 1 ELSE @rank END AS rank,
@score := score AS dummy_value
FROM ( SELECT score,username,ID,firstName,lastName
FROM site_members,
(SELECT @rank := 0, @score := NULL) AS vars
WHERE `status` = 1 AND score > 0
ORDER BY score DESC) AS h;
像这样:
$select = $this -> db -> select();
$select -> from('site_members', array('COUNT(*) AS count'));
$select -> where("ID = ?", $memberID, Zend_Db::INT_TYPE);
$row = $this -> db -> fetchRow($select);