Solved

inner join of 4 table

Posted on 2011-09-20
1
321 Views
Last Modified: 2012-05-12
I am trying to do innner join of 4 table and in my table there is only 2 record but I am doing something wrong in neer join it's repeating and getting total 4 record with saem repeating value.
please help me out with this.



      select  
       customer.Member_Status
      select customer.First_Name
      from      Link_Payment,Customer,Payment_Info,PersonalInfo,Customer_Subscription
       where customer.primarykey = PaymentInfo.UserID and
       customer.primarykey= PersonalInfo.UserID      and
      Link_Payment.SubscriptionID= Customer_Subscription.primaryKey and
        First_Name like 'john%'
0
Comment
Question by:Itgirl16
1 Comment
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 36571051
there is connection between Link_Payment and Customer_Subscription to rest of the tables
select customer.Member_Status, customer.First_Name 
from Customer      
inner join PersonalInfo on customer.primarykey = PersonalInfo.UserID
inner join PaymentInfo on customer.primarykey = PaymentInfo.UserID

--you have not defined these relationaships
inner join Link_Payment on customer.primarykey = Link_Payment.PrimaryKey
inner join Customer_Subscription on Link_Payment.SubscriptionID= Customer_Subscription.primaryKey 
--

where First_Name like 'john%'

Open in new window

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question