网上资料找到的左联接之后 如果2个表都设置了查询条件,会自动变成内联查询,但是这达不到我想要的效果,请问怎么可以变为
SELECT user
.id
, user
.emp_id
, user
.created_at
, user
.updated_at
, notes
.id
AS notes.id
, notes
.title
AS notes.title
, notes
.created_at
AS notes.created_at
, notes
.updated_at
AS notes.updated_at
, notes
.user_id
AS notes.user_id
FROM users
AS user
OUTER JOIN notes
AS notes
ON user
.id
= notes
.user_id
AND notes
.title
LIKE '%css%'
WHERE user
.created_at
< '2015-11-05 01:58:31';
这样的效果。
不一定非要用 Model 的方法,sequelize 兼容原始 SQL 语句。
参考官方文档:http://docs.sequelizejs.com/m...