?
Solved

inner join of 4 table

Posted on 2011-09-20
1
Medium Priority
?
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
Viewers will learn how the fundamental information of how to create a table.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

649 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