Skip to main content
1 of 4
mitomed
  • 539
  • 1
  • 4
  • 16

Sql with several joins

Is this query acceptable in terms of performance (I get the correct data) or can it be optimized.

Thanks

SELECT
    bankInstitution.name,
    person.firstName,
    person.surname,
    offer.offerId,
    bank.personId,
    bank.bankOtherName,
    bank.sortCode,
    bank.number,
    loan.loanId
    offer.campaignId,
FROM bank
    JOIN loan ON bank.personId = loan.personId AND bank.isCurrent = 1
    JOIN offer ON loan.loanId = offer.loanId
    JOIN person ON person.personId = bank.personId
    JOIN bankInstitution ON bankInstitution.bankInstitutionId = bank.bankInstitutionId
WHERE Campaign.Offer.CampaignId = :campaignId AND Campaign.Offer.Processed Is NULL
mitomed
  • 539
  • 1
  • 4
  • 16