A
A
Andrey Veryaskin2016-10-17 12:36:46
MySQL
Andrey Veryaskin, 2016-10-17 12:36:46

How to get rows processed by a query in MYSQL?

The point is the following.
There are two tables t1 and t2 .
t2 stores the result of certain processing on several tables including t1. This processing occurs once a day and first selects from t1 those records that have field=0, after that it connects to other tables, forms the result and writes it to t2.
I need that after this processing, those fields from t1 that were processed change the value of field=1, so that next time there will be more of them to process.
Can this be done on the MYSQL side?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2016-10-17
@Adamos

You start a transaction.
Processing lines.
By the same condition, update the rows.
You complete the transaction.
This, in fact, will be simpler and more reliable than any cleverly crafted queries.

A
Andrey Veryaskin, 2016-10-17
@veryaskinan

And if between "Process lines." and "Update rows by the same condition." there will be a change in table t1 (for example, inserting a record). This condition will no longer apply. How to avoid it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question