我不能正确地编写查询。我需要选择一个列中只有一个值的人。例如,
select * ( select PersonID, sum(TotalAmount) from Table1 group by PersonID HAVING sum(TotalAmount) = 0 ) where Group = A
这意味着我会选择所有的客户,只属于'一'组。。。有人能帮我吗?
holgip5t1#
如果你想要的人只有一个值,那么 having count(*) = 1 我想到:
having count(*) = 1
select personid from table1 group by personid having count(*) = 1;
1条答案
按热度按时间holgip5t1#
如果你想要的人只有一个值,那么
having count(*) = 1
我想到: