Solved

inner join of 4 table

Posted on 2011-09-20
1
293 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

746 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now