OiO.lk Blog SQL Mysql Query batched result grouped
SQL

Mysql Query batched result grouped


I wish to achieve something like this from a MYSQL SELECT query

I wish to group the results from the select in 500 rows (per batch) and have a column called group (or anything) for the key to the group (eg bartch 0 1 2 3)

SELECT * TABEL WHERE X
Would i do the select into a temp table with the a column-indexed then some how do a limit of 500 and move forward?

the reason behind this is so I can call the number again to get all the same rows again

or would it be a better idea to just to select everything thing and let the PHP or Python do the work?

+—-+————+
| Grou| Name |
+——————
| 1 | Ham
| 1 | Bread
+——————
| 2 | Tomato
| 2 | Eges

SELECT * FROM TABLE



You need to sign in to view this answers

Exit mobile version