[snip]
I have question about how I can get top 2 rows for each group.
like I have table test
| seqno |
+-----------+
| 000000122 |
| 000000123 |
| 000000123 |
| 000000123 |
| 000000336 |
| 000000346 |
| 000000349 |
| 000000427 |
| 000000427 |
| 000000427 |
+-----------+------+
I like have
+-----------+------+
| seqno | item |
+-----------+------+
| 000000122 | 1 |
| 000000123 | 1 |
| 000000123 | 2 |
| 000000123 | 3 |
| 000000336 | 1 |
| 000000346 | 1 |
| 000000349 | 1 |
| 000000427 | 1 |
| 000000427 | 2 |
| 000000427 | 3 |
+-----------+------+
Then I can have select * from test where item <3 to find all top 2 rows.
[/snip]
I think you want ...
SELECT DISTINCT(seqno) FROM test ORDER BY seqno LIMIT 2