troubleshooting Question

SQL Join Querry

Avatar of hdcowboyaz
hdcowboyazFlag for United States of America asked on
13 Comments1 Solution294 ViewsLast Modified:
The below query pulls in data but omits rows if the po table has missing data. It still should pull in the rest of the columns even if that column is empty or NULL.

SELECT blah, blah, blah
FROM estdetail d
              LEFT JOIN (
                  emp e
                  JOIN est ON (e.emp_id = est.emp_id_created)
              ) ON (est.est_id = d.est_id)
              LEFT JOIN (
                  funvert f
                  JOIN task t ON (f.funvert_id = t.funvert_id)
                  JOIN releases r ON (r.releases_id = t.releases_id)
                  JOIN project pj ON (pj.project_id = r.project_id)
                  JOIN program pg ON (pg.program_id = pj.program_id)                  
                  JOIN stdtask s ON (s.stdtask_id = t.stdtask_id)                
              ) ON (t.task_id = d.task_id)
              LEFT JOIN (
                  icat ic
                  JOIN item i ON (ic.icat_id = i.icat_id)
                  JOIN itype it ON (it.itype_id = i.itype_id)
                  JOIN mc ON (mc.mc_id = i.mc_id)                      
              ) ON (i.item_id = d.item_id)
              LEFT JOIN (
                  JOIN prtrans prt ON (pr.pr_id = prt.pr_id)
                  JOIN vendor v ON (v.vendor_id = prt.vendor_id)
                  JOIN cc ON (cc.cc_id = prt.cc_id)                  
                  JOIN po ON (po.po_id = prt.po_id)
              ) ON (prt.estdetail_id = d.estdetail_id)                          
WHERE (d.deleted != 'Y' OR d.deleted IS NULL);

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 13 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 13 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