具有以下未从任何其他查询中获取的输入...
(891,892,903,993,1008)
我想为每一个(891
,,892
等)制作以下INSERT
(作为XXXX
实际值)
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);
我怎样才能创建一个函数来将它们全部排成一行,而不是如下一个一个地做?
WHERE exp_id = 891 AND cntr_id <> (SELECT id from plnt where id_emp = 891);
然后等等等等
WHERE exp_id = 892 AND cntr_id <> (SELECT id from plnt where id_emp = 892);
。
提前致谢。