Given a table foo with a composite primary key (a,b), is there a legal syntax for writing a query such as:
SELECT ... FROM foo WHERE a,b IN (SELECT ...many tuples of a/b values...);
UPDATE foo SET ... WHERE a,b IN (SELECT ...many tuples of a/b values...);
If this is not possible, and you could not modify the schema, how could you perform the equivalent of the above?
I’m also going to put the terms “compound primary key”, “subselect”, “sub-select”, and “sub-query” here for search hits on these aliases.
Edit: I’m interested in answers for standard SQL as well as those that would work with PostgreSQL and SQLite 3.
Replace the
select 1 from barwith yourselect ... many tuples of a/b values ....Or create a temporary table of your
select ... many tuples of a/b values ...and use it in place ofbar..