2
select cnt.loginid, grp.last_name as 'Group Name'
from contact cnt
right join grpmem list on cnt.contact_uuid = list.member
left join contact grp on grp.contact_uuid = list.group_id
join contact_acctyp cntacc on cnt.contact_uuid = cntacc.contact_uuid
where cntacc.c_acctyp_id in (select id from acctyp_v2 where sym like 'CDN%')
我已經寫了我們的系統查詢,拉所有加拿大的接觸,他們都在該組的列表。統計查詢結果的多連接語句
現在的人誰是在多個組(他們的登錄ID多次出現)我需要確定他們所在的組的數量(返回一個計數)。但是,我不確定如何執行計數。
我想我的輸出是採用以下格式:
| USER ID | # of Groups |
我似乎無法弄清楚如何把我已經寫成說。
到目前爲止好。現在我只需要一個方法來列出count(*)> 1 – RavB 2010-06-23 20:10:37
的簡單添加方式: HAVING COUNT(*)> 1 – Yellowfog 2010-06-23 20:23:18