execute multiple MySQL queries depends on each other node js

When I tried to execute those queries multiple times the only one Code executed and the notes updated on the first Code, the code doesn't wait the previous query till return the results when execute the query multiple times:

Query1:

('SELECT * FROM X_Table where cId = 20 and dist is null order by id limit 1')

This query return data, one of it named Code. Lets assume that the result 'Code' = 'abcd1234'

Query2:

(UPDATE X_Table SET dist = 1 WHERE code = 'abcd1234')

Note: when SET dist = 1 Query1 should give new results deference from the previous one 'Code'.

Query3:

(UPDATE X_Table SET note = 'note' WHERE code = 'abcd1234')


Read more here: https://stackoverflow.com/questions/64944911/execute-multiple-mysql-queries-depends-on-each-other-node-js

Content Attribution

This content was originally published by AmJaradat01 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: