'How do I solve multiple joins producing duplicate application_id in sql query result
I have this query below and when I include the last join, I keep getting duplicate applicationid is the query result
select distinct
a.id,
a.application_id,
a.ref_num_sequence,
a.payment_date,
a.payment_status,
po.name,
pi.booklet_fee as application_amount,
ph.fee_amount as application_tr_charge,
pi.address_verification_fee,
pi.address_verification_service_charge,
ph.payment_gateway
from applicant a
join processing_info pi on pi.applicant_id = a.id
join payment_header ph on ph.applicant_id = pi.applicant_id
join passport_office po on po.id = pi.processing_office
where a.payment_status = '200' and
a.payment_date between '2022-03-04 00:00:00' and '2022-03-08 23:59:59' and
po.name IN('Enugu','Awka','Owerri','Abakaliki','Umuahia')
order by a.payment_date desc
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|