I have three tables in my database with following details:
ClientMain ClientMatter AdditionalClient
PK ClientID PK MatterID PK. ClientID
FirstName PK ClientID PK. MatterID
LastName MatterDesc FirstName
LastName
Based on above structure I need to print a contract. If there is no additional Client then contract should be printed based on ClientMain table client details, otherwise include AdditionalClient details if exist. The problem I am facing here, when I join both tables (ClientMain and AdditionalClient) contract prints only names those exists in both tables. If there is only one client which has details in ClientMain table and no additional client in associated table (AdditionalClint) details are not shown up in report or query. If I change the join condition then every row from ClientMain table shows additional client name where that data does not belongs to that particular client. The reason of including ClientID and MatterID in AdditionalClient and making compound key is because of MatterID in ClientMatter table starts its counter from one when ClienID is chaged. Any help suggestions highly appreciated.
ClientMain ClientMatter AdditionalClient
PK ClientID PK MatterID PK. ClientID
FirstName PK ClientID PK. MatterID
LastName MatterDesc FirstName
LastName
Based on above structure I need to print a contract. If there is no additional Client then contract should be printed based on ClientMain table client details, otherwise include AdditionalClient details if exist. The problem I am facing here, when I join both tables (ClientMain and AdditionalClient) contract prints only names those exists in both tables. If there is only one client which has details in ClientMain table and no additional client in associated table (AdditionalClint) details are not shown up in report or query. If I change the join condition then every row from ClientMain table shows additional client name where that data does not belongs to that particular client. The reason of including ClientID and MatterID in AdditionalClient and making compound key is because of MatterID in ClientMatter table starts its counter from one when ClienID is chaged. Any help suggestions highly appreciated.