Отсутствующий пункт FROM в posgressql
У меня возникла следующая ошибка при выполнении следующего SQL-запроса в Django после преобразования из sqlite в postgressql, с sqlite он работал нормально.
joined_data = HistoryTable.objects.raw(
'''
SELECT pages_historytable.id, pages_historytable.dial, pages_historytable.request_status, pages_historytable.summary, pages_historytable.registration_date, dashboard_storesemails.emails, dashboard_storescode.agent_name
FROM pages_historytable
LEFT JOIN dashboard_storescode
ON pages_historytable.dial = dashboard_storescode.dial
LEFT JOIN dashboard_storesmails
ON dashboard_storescode.shop_code = dashboard_storesmails.dtscode
WHERE pages_historytable.request_status = 'Rejected' AND pages_historytable.Today_Date = %s;
''',[today])
Ошибка
missing FROM-clause entry for table "dashboard_storesemails"
LINE 2: ...le.summary, pages_historytable.registration_date, dashboard_...