Tenho esta Question
sequelize.question(`SELECT
distinct av.idAnnouncementVehicles as id,
av.value,
CONCAT("https://autoparanaiba.s3-sa-east-1.amazonaws.com/" , SUBSTRING_INDEX(ap.picture, '.', 1) , '-355x180.' , SUBSTRING_INDEX(ap.picture, '.', -1)) as picture,
am.worked_hours,
am.yr AS ano,
md.description AS modelo,
bn.description AS marca,
fu.description AS combustivel,
pw.description AS potência,
tc.description AS tração
FROM announcement_vehicles AS av
left be part of announcemment_photos AS ap on ap.annoucements_id = av.idAnnouncementVehicles
left be part of individuals AS pe on pe.id = av.personId
left be part of agricultural_machine AS am on am.agricultural_machine_id = av.itemId
left be part of itens AS it on it.id = av.itemId
left be part of traction AS tc on tc.id = trac.traction_id
left be part of energy AS pw on pw.id = trac.power_id
left be part of gasoline AS fu on fu.id = trac.fuel_id
the place it.sort=${sort} and (av.plans_id IS NOT NULL or pe.sort = 'jud')
group by av.idAnnouncementVehicles order by av.plans_id, av.idAnnouncementVehicles desc restrict 8`, { sort: sequelize.QueryTypes.SELECT })
.then((end result) => {
return res.json({ success: true, end result: end result })
}).catch((err) => {
return res.standing(400).json(err)
})
E ele me lança este erro
"title": "SequelizeDatabaseError",
"guardian": {
"code": "ER_BAD_FIELD_ERROR",
"errno": 1054,
"sqlState": "42S22",
"sqlMessage": "Unknown column 'model_agricultural_machine.description' in 'area listing'",
"sql": "SELECTnttdistinct av.idAnnouncementVehicles
A Question parecida que tenho
sequelize.question(`SELECT
distinct av.idAnnouncementVehicles as id,
av.value,
CONCAT("https://autoparanaiba.s3-sa-east-1.amazonaws.com/" , SUBSTRING_INDEX(ap.picture, '.', 1) , '-355x180.' , SUBSTRING_INDEX(ap.picture, '.', -1)) as picture,
ve.mileage,
fi.marca,
fi.title,
fi.ano,
fi.ano_modelo as modelo,
fu.description as combustivel
FROM announcement_vehicles as av
left be part of announcemment_photos as ap on ap.annoucements_id = av.idAnnouncementVehicles
left be part of individuals as pe on pe.id = av.personId
left be part of automobiles as ve on ve.item_id = av.itemId
left be part of itens because it on it.id = av.itemId
left be part of fipe as fi on fi.id = ve.fipe_id
left be part of gasoline as fu on fu.id = ve.fuel_id
left be part of coloration as co on co.id = ve.color_id
the place it.sort=${sort} and (av.plans_id IS NOT NULL or pe.sort = 'jud')
group by av.idAnnouncementVehicles order by av.plans_id, av.idAnnouncementVehicles desc restrict 8`, { sort: sequelize.QueryTypes.SELECT })
.then((end result) => {
return res.json({ success: true, end result: end result })
}).catch((err) => {
return res.standing(400).json(err)
})
Mas eu tenho uma parecida no código e não retorna este erro, eu preciso fazer algo no banco pra que possa ser feito esse tipo de question?