这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