Created
July 18, 2012 14:44
-
-
Save mks-m/3136605 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table mc (id int, member varchar(3)); | |
insert into mc values (1, 'abc'), (1, 'pqr'), (2, 'xyz'), (2, 'pqr'), (3, 'pqr'), (3, 'abc'); | |
Select id,count(*) as total from mc group by id having total=(Select count(*) from mc where id=1); | |
-- Result: | |
-- +------+-------+ | |
-- | id | total | | |
-- +------+-------+ | |
-- | 1 | 2 | | |
-- | 2 | 2 | | |
-- | 3 | 2 | | |
-- +------+-------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment