I have 3 tables , posted_leads, ctc_log, and duplicate_leads. If I I have one record with 'session_id' '22'
and there are 5 records with session_id '22' in table 'duplicate' i get 5 records for session_id '22'. I want to have only one record if there is one record
in table posted_leads for session_id '22'., what am I doing wrong here?
SELECT ctc_log.lead_id, ctc_log.submitted_at, posted_leads.session_id, posted_leads.cluster_id, posted_leads.posted_at,
posted_leads.offer_id, posted_leads.site_id, posted_leads.target, posted_leads.affiliate_id, posted_leads.user_ip,
posted_leads.email, posted_leads.phone, posted_leads.response_code, posted_leads.response, posted_leads.external_id,
posted_leads.success, duplicate_leads.failed, ( ( ( concat(posted_leads.cluster_id,'-',posted_leads.session_id) ) ) )
AS u_session_id FROM posted_leads LEFT JOIN ctc_log ON (posted_leads.session_id = ctc_log.session_id) LEFT JOIN duplicate_leads
ON (posted_leads.session_id = duplicate_leads.session_id) WHERE 1 ORDER BY posted_leads.posted_at DESC
I will appreciate your help...
and there are 5 records with session_id '22' in table 'duplicate' i get 5 records for session_id '22'. I want to have only one record if there is one record
in table posted_leads for session_id '22'., what am I doing wrong here?
SELECT ctc_log.lead_id, ctc_log.submitted_at, posted_leads.session_id, posted_leads.cluster_id, posted_leads.posted_at,
posted_leads.offer_id, posted_leads.site_id, posted_leads.target, posted_leads.affiliate_id, posted_leads.user_ip,
posted_leads.email, posted_leads.phone, posted_leads.response_code, posted_leads.response, posted_leads.external_id,
posted_leads.success, duplicate_leads.failed, ( ( ( concat(posted_leads.cluster_id,'-',posted_leads.session_id) ) ) )
AS u_session_id FROM posted_leads LEFT JOIN ctc_log ON (posted_leads.session_id = ctc_log.session_id) LEFT JOIN duplicate_leads
ON (posted_leads.session_id = duplicate_leads.session_id) WHERE 1 ORDER BY posted_leads.posted_at DESC
I will appreciate your help...