sql - MySQL Join duplicate result set, how can I solve the issue? -


****tables list****

here going explain relationship between tables.

table: campain

(1.*) (id, campain_id)

table: prospect_list_campaigns

(1.*) prospect_list_id, prospect_list_id

table: prospect_lists_prospects

(1.*) related_id, contact_id

table: call_campaign

as call_campaign table, remind_call linked prospect_lists_prospects table.

table: prospect_lists_prospects

(1.*) related_id, contact_id

table: remind_call

when run without remind_campaign, it gives duplicated output

abc cam | 2 cam 2 | 2 cam 2 | 2 abc cam | 3 cam 2 | 3 cam 2 | 3 

and mysql is

select  campaigns.name name, call_campaign.id call_done campaigns join prospect_list_campaigns on prospect_list_campaigns.campaign_id = campaigns.id join prospect_lists_prospects on prospect_lists_prospects.prospect_list_id = prospect_list_campaigns.prospect_list_id join call_campaign on call_campaign.cantact_id = prospect_lists_prospects.related_id prospect_lists_prospects.related_id = '12' 

and if add remind_call table this, it gives nothing,

mysql is

select  campaigns.name name, call_campaign.id call_done, remind_campaign.id call_remind campaigns join prospect_list_campaigns on prospect_list_campaigns.campaign_id = campaigns.id join prospect_lists_prospects on prospect_lists_prospects.prospect_list_id = prospect_list_campaigns.prospect_list_id join call_campaign on call_campaign.cantact_id = prospect_lists_prospects.related_id join remind_campaign on remind_campaign.contact_id = prospect_lists_prospects.related_id prospect_lists_prospects.related_id = '12' 

i trying here retrieve campaign data related contact(id 12). want if contact call , remind call campaign.

can please me fix error..thank


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -