2011-02-11 57 views

回答

3

你可以嘗試之前:

SELECT * FROM products WHERE category_id = 1 LIMIT 100 
UNION 
SELECT * FROM products WHERE category_id = 2 LIMIT 100 
UNION 
SELECT * FROM products WHERE category_id = 3 LIMIT 100 
UNION 
SELECT * FROM products WHERE category_id = 4 LIMIT 100 
UNION 
SELECT * FROM products WHERE category_id = 5 LIMIT 100 

這將返回第一從1到5的每個類別有100條記錄。

+0

+1,儘管您想要使用UNION ALL – RichardTheKiwi 2011-02-11 08:02:47

相關問題