zend 框架选择对象和复杂连接
我正在尝试学习使用 select 对象,它确实使用起来很舒服,至少对于不太复杂的查询来说是这样。使用这个代替手动 sql 查询有什么限制吗?
我更愿意在我的应用程序中的任何地方使用它,但真的不知道如何将它用于像这样的更复杂的查询:
SELECT yt.rowid, yt.concat, added_latest, yt.volume, (yt.risk*yt.volume)
FROM obsoletes.batches yt
INNER JOIN(
SELECT rowid, batch, concat, volume as latest_vol, MAX(added) AS added_latest
FROM obsoletes.batches
GROUP BY concat) ss
ON yt.added = ss.added_latest AND yt.batch = ss.batch
WHERE yt.concat = 'something'
GROUP BY yt.batch
这可能吗?又如何呢?文档不是那么好。我也可以使用 WHERE x IN ( ... ) 与选择对象?
提前致谢!
I am trying to learn to use the select object which is really comfortable to use, at least with less complex queries. Is there any limitations using this instead of manual sql queries?
I would prefer to use it everywhere in my application but really don't know how to use it for more complex queries like this one:
SELECT yt.rowid, yt.concat, added_latest, yt.volume, (yt.risk*yt.volume)
FROM obsoletes.batches yt
INNER JOIN(
SELECT rowid, batch, concat, volume as latest_vol, MAX(added) AS added_latest
FROM obsoletes.batches
GROUP BY concat) ss
ON yt.added = ss.added_latest AND yt.batch = ss.batch
WHERE yt.concat = 'something'
GROUP BY yt.batch
Is this possible? And how? The documentation is not that great. Could I also use
WHERE x IN ( ... ) with the select object?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定,但类似这样:
Not sure, but something like that: