此SQLite
查询中出现此错误:
select f.rid, c.title, sum(some_expression) as ratio
from doesntmatter
where c.active = 1 or (ratio = 1.0 and c.active = 0
and c.deactivated in (1, 2, 3, 4, 5)
group by f.rid
这个问题用having
子句解决:
select f.rid, c.title, sum(some_expression) as ratio
from doesntmatter
where c.active = 1 or (c.active = 0
and c.deactivated in (1, 2, 3, 4, 5)
group by f.rid
having ratio = 1.0
但在我的例子中,这改变了表达式的语义。你知道如何实现原始where
子句中的表达吗?