select count(PARTY_NAME),party_name from(
SELECT distinct hp.PARTY_ID,hp.PARTY_NUMBER,hp.PARTY_NAME
FROM
hz_cust_accounts hca,
hz_parties hp,
hz_cust_acct_sites_all hcas
WHERE hp.party_id = hca.party_id
AND hcas.cust_account_id =hca.CUST_ACCOUNT_ID
and hcas.ORG_ID=85
)
group by party_name
having count(PARTY_NAME)>1
SELECT distinct hp.PARTY_ID,hp.PARTY_NUMBER,hp.PARTY_NAME
FROM
hz_cust_accounts hca,
hz_parties hp,
hz_cust_acct_sites_all hcas
WHERE hp.party_id = hca.party_id
AND hcas.cust_account_id =hca.CUST_ACCOUNT_ID
and hcas.ORG_ID=85
)
group by party_name
having count(PARTY_NAME)>1