Having the following inputs which aren't taken from any other query...
(891,892,903,993,1008)
I wanto to make for each one, (891
, 892
, etc.) the following INSERT
(being XXXX
the actual value)
INSERT INTO myTable (id, name)
SELECT
id,
name
FROM myTable
WHERE exp_id = XXXX AND cntr_id <> (SELECT id from plnt where id_emp = XXXX);
How can I make a function to make all of them in a row instead of doing one by one as follows?
WHERE exp_id = 891 AND cntr_id <> (SELECT id from plnt where id_emp = 891);
and then
WHERE exp_id = 892 AND cntr_id <> (SELECT id from plnt where id_emp = 892);
etc.etc.
Thanks in advance.