作者jami520 (我的生命因你而發光)
看板Database
標題[SQL ] Invalid use of group function
時間Sat Feb 23 22:54:30 2013
請問這樣寫有錯嗎?
SELECT sid, bid, SUM(num) FROM mydbtable WHERE gdate>=
'2013-02-18' and gdate<= '2013-02-22' and SUM(num)/SUM(num/percentage)>0.05
GROUP BY concat(binary bid)
附註:sid, bid, num, percentage為table欄位
產生的錯誤為Invalid use of group function
找了很久,不曉得是哪邊錯誤呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.71.217.130
1F:推 icydream:select的欄位,與group by的欄位不符 02/24 17:41
2F:→ icydream:改為select concat(binary bid), sum(num)試試, 02/24 17:42
3F:→ icydream:或是再重新調整group by的欄位。 02/24 17:43