?
Solved

Simple SQL Join Query Syntax Issue

Posted on 2010-01-12
2
Medium Priority
?
219 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
[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
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

752 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