refs #5525 fix sql supplier for sepacore
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-12-28 13:27:38 +01:00
parent bfb31ad7c3
commit bbf1bb50e9
1 changed files with 8 additions and 6 deletions

View File

@ -17,9 +17,11 @@ FROM
LEFT JOIN country sc ON sc.id = s.countryFk LEFT JOIN country sc ON sc.id = s.countryFk
LEFT JOIN province sp ON sp.id = s.provinceFk LEFT JOIN province sp ON sp.id = s.provinceFk
LEFT JOIN province p ON p.id = c.provinceFk LEFT JOIN province p ON p.id = c.provinceFk
LEFT JOIN bankEntity be ON sa.supplierFk = s.id LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
LEFT JOIN supplierAccount sa ON sa.bankEntityFk = be.id LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id
WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk) WHERE
ORDER BY (m.companyFk = ? OR m.companyFk IS NULL)
m.created DESC AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk))
LIMIT 1; ORDER BY
m.created DESC
LIMIT 1;