I hope this is a simple question.

I'm trying to run a select like the one below, but limiting the results to 2 Sub
Categories per Category.

I can't find a way to do this in the SQL reference

mysql> select sub_categories.id, categories.name 'Category', sub_categories.name
'Sub Category' from categories, sub_categories where sub_categories.category_id
= categories.id;
+-----+----------+-------------------------+
| id  | Category | Sub Category            |
+-----+----------+-------------------------+
|   1 | Audio    | MP3 Players             |
|   2 | Audio    | Speakers                |
|   3 | Audio    | Car stereos             |
|   5 | Audio    | Complete Systems        |
|   6 | Cars     | Classic Cars            |
|   7 | Cars     | New Cars                |
|   8 | Cars     | Car Rental              |
| ... | ...      | ...                     |
|  95 | Weddings | Mother Of The Bride     |
|  96 | Weddings | Photographers           |
|  97 | Weddings | Stag & Hen              |
|  98 | Weddings | Invitations             |
|  99 | Weddings | Video / DVD             |
| 100 | Weddings | Wedding Favours         |
+-----+----------+-------------------------+

Thanks,
Gareth


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

Reply via email to