Avatar of edrz01
edrz01
Flag for United States of America asked on

Need help with multiple table join

I need a query to read data from 3 tables

Table 1 – EOC_Orion (Need OrionID, Name) – Unique data
Table 2 – EOC_Node (Need Caption) – Each node will be identified by OrionID and NodeID
Table 3 – EOC_Volume (Need Caption, PercentUsed) -

The query needs to basically get volume data (from EOC_Volume) for each node (EOC_Node) and include the name from the Orion (EOC_Orion)

Sample data
EOC_Orion
      OrionID      Name
      12      Salem
      13      Mobile
      14      Portland

EOC_Node
      OrionID      NodeID      Caption
      12      123      Howdy
      12      129      Doody
      13      15      Zipper
      13      123      Zinger
      13      210      Zapper
      14      123      Alpine

EOC_Volume
      OrionID      NodeID      Caption      PercentUsed
      12      123      C:\      80%
      12      129      C:\      54%
      13      15      D:\      49%
      13      123      C:\      63%
      13      210      C:\      79%
      14      123      C:\      85%
      14      123      D:\      97%

Desired Results

Salem      Howdy      C:\      80%
Salem      Doody      C:\      54%
Mobile      Zipper      D:\      49%
Mobile      Zinger      C:\      63%
Mobile      Zapper      C:\      79%
Portland      Alpine      C:\      85%
Portland      Alpine      D:\      97%

A node caption is identified in the EOC_Node table by OrionID and NodeID. The NodeID can actually be duplicated as long its OrionID is unique.
In the EOC_Volume table

Basically what I want to do is get the name contained in the EOC_Orion table (based on OrionID) and the caption contained in the EOC_Node (based on OrionID and NodeID) for each volume in EOC_volume.

So my original EOC_Volume table looks like

OrionID      NodeID      VolumeID      Caption      
12      123      15      C:\            
12      129      16      C:\            
Microsoft SQL Server

Avatar of undefined
Last Comment
lisa_mc

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
lisa_mc

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
edrz01

ASKER
Thank you for the FAST reply. It was dead on and worked like a champ!
lisa_mc

you are very welcome

glad I could help
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck