我是 sql 新手,遇到了一个小问题。我有一个这样的查询:
select cust_id, count(1) from all_customers
group by cust_id
having count(1)>4;
该查询给了我想要的结果。
我需要对all_customers
表中的所有客户进行新查询,并排除我刚刚从上面的查询中得到的结果。我试着做这样的事情:
select * from all_customers
where cust_id NOT IN
(
select cust_id, count(1) from all_customers
group by cust_id
having count(1)>4
)
但我收到错误消息too many values
。我究竟做错了什么?