我有一个带有can be 之类remarks
的列的表,
我希望我的查询返回没有子查询的以下列。id, story_id, like
+1
-1
select
story_id, total, n_like, n_dislike
total = n_like + n_dislike
我目前正在做一个group by
on like
and select
ing like as like_t, count(like) as total
,这给了我一个输出,比如
-- like_t --+ --- total --
-1 | 2
1 | 6
并在结果集中返回两行。但我想要的是得到1
行 where n_like is 6
and n_dislike is 2
and total
is8