troubleshooting Question

Need help with multiple table join

Avatar of edrz01
edrz01Flag for United States of America asked on
Microsoft SQL Server
3 Comments1 Solution191 ViewsLast Modified:
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
      OrionID      Name
      12      Salem
      13      Mobile
      14      Portland

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

      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:\            

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
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 1 Answer and 3 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