troubleshooting Question

Joining 3 Tables

Avatar of Quantum_Leaper
Quantum_LeaperFlag for Afghanistan asked on
MySQL Server
8 Comments2 Solutions272 ViewsLast Modified:

I am trying to join three tables; one contains elected official data called Officials (ID, name, etc.), the second contains ethics reports for each official and is joined at the ID (Officials.ID to EthicsRpts.OfficialsID).  So the Reports for each official is presented along with some of the officials name data.  The query looks like this (very simple):
SELECT  Officials.FirstName,Officials.MidName,Officials.LastName,Officials.Sufx,EthicsRpts.RptLink
From Officials,EthicsRpts
Where EthicsRpts.OfficialsID=Officials.ID

I need to join a third table  - EthicsRptTypes which contains two fields, ID and RptType.  RptType has the report name (ex Treasurer's Report). The EthicsRptType.ID is the same as EthicsRpts.RptType.  I need to add the EthicsRptType.RptType value for each report and it is joined on EthicsRpts.RptType = EthicsRptTypes.ID.  This will be used to replace the numeric value in EthicsRpt with a logical label like Treasurer's Report which comes from the EthicsRptTypes table  .

I am a designer and don't get too involved with queries so I am rusty and joining a third table  is new to me.  Any help appreciated.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros