Current scenario :
I have a MySQL database (products_db) with product links ('links') . Now the products / links are from 11 different websites (advertisers).
Is there some sort of MySQL query I can make to get the results in groups of 11 links, one link for each website ?
The point is to get a list of results with all the links, one link for each 11 website .
I know I can use the following to get the first 11 rows each from a different website, but I need ALL the results arranged like that .
SELECT id, name, advertiser, link
FROM table
GROUP BY advertiser
If not, I guess I have to go back to sort the list in PHP ..
thanks!
使用group by
而不是order by
:
SELECT id, name FROM table GROUP BY id
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.