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

标签 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 语句。 有谁知道如何将 ANYALL 应用于 Zend Framework 2 中的查询?

最佳答案

为什么不使用连接表?

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

问候

关于mysql - 使用 ALL 和 ANY 语句创建子查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30719202/

相关文章:

mysql - 将 id 替换为 MySQL 中交叉连接中其他表中的用户名

php - ControllerPlugin 类中的 ZF2 getServiceLocator

dependency-injection - ZF2 服务定位器和依赖注入(inject)

PostgreSQL:带有 ANY($1) 的 PREPARED 语句

php - 使用 PHP 输入高尔夫分数并存储在 MySQL 中

mysql - 存储在 Magento 数据库中的优惠券代码

php - 插入数据 mysqli 不工作

php - ZF2,添加多个表

c# - 在比较一个属性时检查列表是否包含所有其他列表项

swift - 在 Swift 中结合 IF LET 和 OR