We help IT Professionals succeed at work.
Get Started

Join 2 tables and show everything from left table.

corey gashlin
on
54 Views
Last Modified: 2019-11-25
I have 2 tables I am trying to join. i have tried joining but it is not working how I would like.

Table 1 - OCI_DISCIPLINES - Shows as below -
discipline
Mechanical
Electrical
Plumbing
Fire Protection
Cx
Low Voltage
Report
Study
CAD
BIM

Table 2 - OCI_VOODOO Shows as below

Department      proj_id      timing
CAD      2147      21h 0m
Cx      2147      73h 20m
Electrical      2147      40h 30m
Mechanical      2147      88h 30m
Plumbing      2147      42h 0m

Trying to get Table1 to show all the rows for disciplines and join up to table 2.

Result I am looking for is this.

Department      proj_id      timing
CAD      2147      21h 0m
Cx      2147      73h 20m
Electrical      2147      40h 30m
Mechanical      2147      88h 30m
Plumbing      2147      42h 0m
Low Voltage 2147        0
Study          2147           0
Fire Protection 2147     0


SELECT        dbo.OCI_DISCIPLINES.discipline, dbo.OCI_VOODOO.proj_id, dbo.OCI_VOODOO.timing, dbo.OCI_DISCIPLINES.id
FROM            dbo.OCI_DISCIPLINES LEFT OUTER JOIN
                         dbo.OCI_VOODOO ON dbo.OCI_DISCIPLINES.discipline = dbo.OCI_VOODOO.Department  Where OCI_VOODOO.proj_id=2147

Open in new window



This is waht I made and it not working.
Comment
Watch Question
Senior Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE