I got a set of queries that will be interupted. Therefore I need to stop the query, save the last added ID and continue adding contents from the last ID on another day.
Szenario:
1) I query data from another table (Table-A) like this:
SELECT *
FROM $table_A
ORDER BY uID ASC
2) Then I add to a table (Table-B) that “looks” like this:
|¯¯¯¯¯|¯¯¯¯¯¯¯¯|¯¯¯¯¯¯|¯¯¯¯¯|¯¯¯¯¯|
| uID | SubID* | Name | Foo | Bar |
|-----|--------|------|-----|-----|
| 1 | 23 | Boo | Goo | Shu |
|_____|________|______|_____|_____|
3) For each row I query from the Table-A table I add data to the Table-B table. (Note: This table already has the uID, SubID and Name when I add the data.)
4) The query gets interrupted/stops. Then I save the uID* of the latest added row – before the queries stop – to a separate table (Table-C).
Question: How can I start the query – after interruption (let’s say on the next day) – again, but starting from the next row after last I saved on the previous day (The uID will be available).
Example:
SELECT *
FROM $table_A
ORDER BY uID ASC
LIMIT $last_uID, COUNT $table_A (a.k.a "the last ID in the table")
Thanks!
Notes:
- The SubID connect rows to other tables & can exist more than once.
- UID = Unique Identifier (Auto Increment).
Well you know what the last ID added was, because it will be in table_B.
UPDATE:
Seems this is what is required.