Simon
Simon

Reputation: 5698

MySQL Subqueries

I was wondering if something like this is possible in MySQL:

SELECT * FROM tmpTable WHERE id = 1 AND ISTRUE(UPDATE tmptTable SET value = 1)

Or

SELECT * FROM tmpTable WHERE id = (INSERT INTO tmptTable (name) VALUES ('test'))

Or the same query with UNION or something

What i'm trying to do with this is SELECTing only the records that are updated/by the ID's they are inserted. I want to know if it's acutally possible to do an Update or Insert query INSIDE an other query.

Upvotes: 0

Views: 221

Answers (1)

Simon
Simon

Reputation: 5698

Looks like you are trying to do composable DML. No this isn't supported in MySQL. – Martin

https://stackoverflow.com/users/513811/martin

He just gave the answer, but as a comment...

Upvotes: 1

Related Questions