You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately with this information we are too limited to respond. Please open a discussion at https://github.com/sequelize/sequelize with some additional information about your project and maybe somebody can help you out
trying to use model1 attribute Id in where condition of literal
model1.findAll({
include: [{ model: model2, as: 'model2' }],
attributes: {
include: ['*', [literal(
( SELECT COUNT(*) FROM table3 T3 JOIN table2 T2 ON T3.T2Id = T2.Id JOIN table1 T1 ON T3.T1Id = T1.Id WHERE T2.Type = model2.Type AND T3.T2Id = model1.Id )
),'Alloted']]
},
})
What do you expect to happen?
where condition should take input from model1 Id
What is actually happening?
model1.Id unknown column
Output, either JSON or SQL
Unhandled rejection SequelizeDatabaseError: Unknown column 'model1.Id' in 'where clause'
Dialect: mysql
Database version: workbench 8.0
Sequelize CLI version: ^7.0.0-alpha.2
Sequelize version: ^7.0.0-alpha.2
The text was updated successfully, but these errors were encountered: