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.


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to