| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
|Accredited PayPal World Seller|
|Is this possible in Mysql|
| 9:14 am on Aug 17, 2010 (gmt 0)|
If I have a table with 100 products in it, half are from Brand A, half are from Brand B. How do I say:
SELECT * FROM table_name
BUT ... show 10 products from Brand A and 10 products from Brand B
Maybe it's early but I can't quite get my head around how to write this query.
|brotherhood of LAN|
| 11:51 am on Aug 17, 2010 (gmt 0)|
You can use the UNION operator, so something like this should be good.
SELECT * FROM table WHERE product = 'a' LIMIT 10
SELECT * FROM table WHERE product = 'b' LIMIT 10
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved