I’d really like know if it’s possible to do a select statement, which returns exactly same records, that we put into in clause?
Sample:
select * from table
where table_id in (1, 2, 3, 666);
This table for an example has only id-s from 1 to 100, so this select will return only three rows. What I need to do, to get also one (probably null or dummy) row for 666?
Thanks!
You could use union:
is how you could do it in Oracle. The
from dualmight vary depending on what database system you’re using.Just be aware that if you use union, your dummy query MUST select the same records as the real query.