Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Simple SQL Join Query Syntax Issue

Posted on 2010-01-12
2
Medium Priority
?
224 Views
Last Modified: 2012-05-08


I am running a Select Statement by fetching values from Multiple Tables.

I have

Member  Table
MemberInsuranceCompany Table
InsuranceCompanies Table

MemberInsuranceCompany Tables carries InsuranceCompanyId and MemberId.
InsuranceCompanies Tables carries only Insurance details ..!
I need to fetch MemberName and his Insurance Company.

Can you please guide me in the syntax ..!
select Mem.LastName + ','+ Mem.FirstName as [MemberName],
 Rx.RxproName,DOB
-- ,IC.ICName 
from memberstatus MS 
inner join Members Mem
on Mem.MemberId = MS.MemberId
inner join Rxprocessors Rx
on Rx.RxProcessorId = Mem.RxProcessorId
inner join MemberInsuranceCompany MIC
on MIC.MemberId = Mem.MemberId
--inner Join InsuranceCompanies
--on	IC.InsuranceCompanyId = MIC.InsuranceCompanyId
where MS.status = 'A'

Open in new window

0
Comment
Question by:chokka
2 Comments
 
LVL 41

Accepted Solution

by:
ralmada earned 2000 total points
ID: 26299387
Something like this?
select Mem.LastName + ','+ Mem.FirstName as [MemberName], 
 Rx.RxproName,DOB,IC.ICName  
from memberstatus MS  
inner join Members Mem on Mem.MemberId = MS.MemberId 
inner join Rxprocessors Rx on Rx.RxProcessorId = Mem.RxProcessorId 
inner join MemberInsuranceCompany MIC on MIC.MemberId = Mem.MemberId 
inner Join InsuranceCompanies IC on IC.InsuranceCompanyId = MIC.InsuranceCompanyId 
where MS.status = 'A'

Open in new window

0
 

Author Closing Comment

by:chokka
ID: 31676445
Thanks
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

581 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