Maverick0o0
Maverick0o0

Reputation: 31

How to execute more than one query on one table at the same time

Can i execute more than one query on one table at the same time? for example i want to have 4 different searches on one the table at the same time. like this SELECT * FROM TABLE WHERE id=1,SELECT name FROM TABLE WHERE id=4. i want to execute all of them at the same time in separate command.

Upvotes: 0

Views: 87

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521209

Well you could use WHERE IN (...) logic:

SELECT *
FROM yourTable
WHERE id IN (1, 2, 3, 4)
ORDER BY id;

The only possibile difficultly would be keeping track of whence id each record appears in the result set. Using an ORDER BY id clause might be one way to deal with this Python, as you could then iterate in order, and retrieve the set of records for each id value.

Upvotes: 2

Related Questions