SubSonic 中的表别名
如何使用 SubSonic 2.1 为表分配别名?
我正在尝试重现以下查询:
SELECT *
FROM posts P
RIGHT OUTER JOIN post_meta X ON P.post_id = X.post_id
RIGHT OUTER JOIN post_meta Y ON P.post_id = Y.post_id
WHERE X.meta_key = "category"
AND X.meta_value = "technology"
AND Y.meta_key = "keyword"
AND Y.meta_value = "cloud"
我正在使用 SubSonic 2.1 并且升级到 2.2 还不是一个选项。谢谢。
How can I assign alias to tables with SubSonic 2.1?
I am trying to reproduce the following query:
SELECT *
FROM posts P
RIGHT OUTER JOIN post_meta X ON P.post_id = X.post_id
RIGHT OUTER JOIN post_meta Y ON P.post_id = Y.post_id
WHERE X.meta_key = "category"
AND X.meta_value = "technology"
AND Y.meta_key = "keyword"
AND Y.meta_value = "cloud"
I'm am using SubSonic 2.1 and upgrading to 2.2 isn't an option (yet). Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
2.1 中是否存在 CodingHorror 功能?它在文档中声明它属于 2.x 类别。
Does the CodingHorror functionality exist in 2.1? It states on the docs that it's in the 2.x category.
使用视图:
那么你的查询就变成:
是的,我知道,这很粗糙。但还是有效的。如果您想要优雅,请按照已经建议的方式进行升级,否则这对于临时解决方法来说应该足够了。
Use a view:
Then your query becomes:
Yes, I know, it's crude. But effective nonetheless. If you want elegance then upgrade as has already been suggested, otherwise this should be sufficient for a temporary workaround.
我认为如果你只使用亚音速 2.2 就可以完成工作。您应该认真考虑升级。 2.2 版本有更多好处,可以让您的生活更美好。
I think if you just use in subsonic 2.2 will do the work. You should seriously consider upgrading. Version 2.2 has a lot more goodies to make your life better.