使用nodejs sequelize进行mysql的数据库查询,只会只用它查询一张表,如果想要同时查询两张表达到如下效果
MYSQLSELECT * FROM A,B WHERE A.name = B.name;
MYSQL
SELECT * FROM A,B WHERE A.name = B.name;
ringa_lee
參考這篇http://www.it165.net/pro/html/201508/50341.html
定義表格關聯關係,請參閱:http://docs.sequelizejs.com/en/latest/docs/associations/關聯查詢,請參閱:http: //docs.sequelizejs.com/en/latest/docs/querying/#relations-associations
歷史版文件v2.0 http://docs.sequelizejs.com/en/2.0/v1.7 http://docs.sequelizejs.com/en/1.7.0/
參考這篇
http://www.it165.net/pro/html/201508/50341.html
官方目前最新版本v3.13.0
定義表格關聯關係,請參閱:http://docs.sequelizejs.com/en/latest/docs/associations/
關聯查詢,請參閱:http: //docs.sequelizejs.com/en/latest/docs/querying/#relations-associations
歷史版文件
v2.0 http://docs.sequelizejs.com/en/2.0/
v1.7 http://docs.sequelizejs.com/en/1.7.0/