Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id | email | domain
- ---|--------------|--------
- 1 | foo@bar.de | bar.de
- 2 | baz@bar.de | bar.de
- 3 | admin@bar.de | bar.de
- 4 | info@bar.de | bar.de
- 5 | bar@foo.com | foo.com
- 6 | baz@foo.com | foo.com
- select t.*
- from thetable t
- where (select count(*)
- from thetable t2
- where t2.domain = t.domain and t2.id <= t.id
- ) <= 2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement