In a table of articles
title varchar(255),
category int(11),
processed enum('yes', 'no'),
... other columns
, I want to process rows (SELECT
a row and then UPDATE
). However, I need to do this diversely for all categories. Not processing randomly, e.g. all records for a category, but nothing for another.
Basic Case: process x rows for each category.
Advanced Case: define a daily limit for each category (in its table). This will be similar to crawlers, as we define how many pages should be crawled for a domain in a given period of time.
Example:
SELECT * from articles WHERE process='no' LIMIT 1
edit the columns in PHP
UPDATE articles .... WHERE id=xx (id comes from SELECT).
Table:
id title category process
1 title1 3 no
2 title2 3 no
3 title3 3 no
4 title4 3 no
5 title5 5 no
6 title6 5 no
7 title7 5 no
If I run the query regularly by cron, it will process all articles in category 3 then category 5. I want a query to process one from category 3, then one from category 5, and so forth. I want to process from all categories gradually.