简体   繁体   English

Sails.js中的复杂数据库查询

[英]Complex database queries in Sails.js

How can I do complex database queries such as joins using Sails.js? 如何使用Sails.js执行复杂的数据库查询,例如联接?

I tried the generate method using the command line, it's great and I connected it to my MySQL database and it works great, but now what I need to understand is how I can do complex SELECT statements. 我使用命令行尝试了generate方法,这很棒,并且将其连接到我的MySQL数据库,并且效果很好,但是现在我需要了解的是如何执行复杂的SELECT语句。 I can't find it in the documentation. 我在文档中找不到它。

For complicated queries refer to this answer by particlebanana , one of Sails.js core contributors. 对于复杂的查询,请参阅本答案particlebanana ,Sails.js核心贡献者之一。

As an alternative to perform joins, you can use the associations branch. 作为执行连接的替代方法,您可以使用关联分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM