|
create table g_applydetail (g_applyno char (3), g_name nvarchar (10), g_cardid varchar (10))
insert g_applydetail select '001', 'Zhang San', '350124'
union all select '002', 'Li Si', '370103'
union all select '003', 'King Wu', '430105'
union all select '004', 'Zhang San', '350124'
select g_cardid, num = count (g_cardid)
from g_applydetail
group by g_cardid
having count (g_cardid)> 1
--- result
g_cardid num
---------- -----------
350 124 2
(1 row (s) affected) |
|