sql select all in in

时间:2014-06-20 07:36:08

标签: select where informix

我需要像这样选择:

Select * from father 
  where All (select age, high from sons where father.id = sons.f_id) 
          IN ( (18, 150), (19, 138))

这可能吗?我总是有语法错误。我使用informix数据库。

谢谢,    卢卡斯

1 个答案:

答案 0 :(得分:0)

SELECT *
FROM father
WHERE NOT EXISTS (SELECT 1
                  FROM sons
                  WHERE sons.f_id = father.id
                  AND NOT ((sons.age = 18 AND sons.high = 150)
                           OR (sons.age = 19 AND sons.high = 138)))