如何找到处于活动状态的组?
How to find group which is having Status Active?
我有一个 id 在 table 中有多个 Accountid,状态为 Active 。我需要找到特定 ID 的活动组。
请查找我的以下查询。它是否正确或需要修改某些内容以获得更好的优化结果。
select id,count(Accountid) from CustomerAccount
where status='Active'
group by id
having count(*)>( select min(maxxount) from(
select id,count(accountid) as maxxount
from CustomerAccount
group by id)A)
使用这个查询:
select id,count(Accountid) from CustomerAccount
where status='Active'
group by id
having count(*) >1
我有一个 id 在 table 中有多个 Accountid,状态为 Active 。我需要找到特定 ID 的活动组。
请查找我的以下查询。它是否正确或需要修改某些内容以获得更好的优化结果。
select id,count(Accountid) from CustomerAccount
where status='Active'
group by id
having count(*)>( select min(maxxount) from(
select id,count(accountid) as maxxount
from CustomerAccount
group by id)A)
使用这个查询:
select id,count(Accountid) from CustomerAccount
where status='Active'
group by id
having count(*) >1