1
我與Zend合作,我不能低於查詢轉換爲zend_db
選擇對象格式:轉換複雜的查詢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);
我覺得世界很大,但我不能得到我的答案 –