|
bandi
Flowing Fount of Yak Knowledge
India
1711 Posts |
Posted - 10/12/2012 : 05:46:27
|
DECLARE @tab TABLE(customer bigint, account int) INSERT INTO @tab SELECT 111111, 1 UNION ALL SELECT 111111, 1 UNION ALL SELECT 111111, 2 UNION ALL SELECT 222222, 2 UNION ALL SELECT 333333, 3 UNION ALL SELECT 333333, 4 UNION ALL SELECT 444444, 4 SELECT account, MIN(customer) FROM @tab GROUP BY account HAVING COUNT(distinct customer) > 1
-- Chandu |
 |
|