使用ALL和ANY语句创建子查询

时间:2015-06-08 21:13:01

标签: mysql zend-framework2 any

我正在尝试进行此查询

SELECT * FROM district 
WHERE id = ANY (SELECT districtId FROM address 
WHERE id = ANY (SELECT addressId FROM schedule
WHERE workshopId = '1'))

我真正的问题是插入ANY语句。 有谁知道如何在Zend Framework 2中将ANYALL应用于查询?

1 个答案:

答案 0 :(得分:0)

为什么不使用连接表?

select * from distrinct as d
join address as a using(districtId)
join schedule as s on s.addressId=a.addressId and s.workshopId = '1';

问候