這MySQL查詢給了我這個錯誤'Unknown column 'winnings' in 'field list'
如何檢查同一查詢中的聚合函數的值?
SELECT
o.user_id,
sum(case when o.result = 1 or o.result=2 or o.result = 0 then 1 else 0 end) as tahmins_no,
sum(case when o.result = 1 then 1 else 0 end) as winnings,
sum(case when o.result = 2 then 1 else 0 end) as loses,
sum(case when winnings = 10 then 0.5 else 0 end) as counter
FROM `odds_tahminler` o
我知道winnings
是sum()
聚合函數的值,但是有什麼辦法來檢查查詢中的winnings
價值?
我只看到'o'表,你的'u'表在哪裏? – Alex 2015-02-23 18:27:36
@Alex你是對的我編輯它 – Basel 2015-02-23 18:35:00
你是什麼意思'檢查*獎金*值? – Alex 2015-02-23 18:46:44