我正在摆弄创建子查询以适应它们。如果某个人的ID出现在联结表X次数中,我试图获得ID号和相关费用。我试过子查询中的聚合
select id, charges from myTable
where id in
(
select id from jxnTable
having (count(jxn.id> 10))
group by jxn.id
这给我的错误jxn.id is invalid in the select list because it is not contained in either an aggregate function of a group by clause.
哎呀,对不起,我编辑你的答案,而不是我的:页面刷新,我点击了错误的链接。 – dasblinkenlight
我知道这可以通过加入完成,但我试图让自己熟悉子查询:) – wootscootinboogie
@dasblinkenlight我在编辑过程中弹出编辑通知 - 我的习惯是复制所有我自己的编辑所以我可以粘贴回编辑:) –