refs #5525 mod yml y sql #1491
|
@ -17,9 +17,11 @@ FROM
|
|||
LEFT JOIN country sc ON sc.id = s.countryFk
|
||||
LEFT JOIN province sp ON sp.id = s.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.bankEntityFk = be.id
|
||||
WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk)
|
||||
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.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))
|
||||
ORDER BY
|
||||
m.created DESC
|
||||
LIMIT 1;
|
||||
|
|
Loading…
Reference in New Issue