Need to add a 3rd table to this join

The following code works fine.
But I need to add that we only want part# that have a reporting code that is, are not blank in this table
IAPRT#. IARCC9
and then we need to sort by that as well.

select ItQty#,IhDocd,ItPRT# from pklib.Fileout1 a        
                     join astdta.icEct1 b on              
b.CtCom#= a.ItCom# and                                    
                                                         
b.CtCtr# = ' '     and                                    
                                                         
b.CtPrt# =a.ItPrt#                                        
order by a.ItPRT#
Philky101Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anthony PerkinsCommented:
Do you want to provide us some details regarding this 3rd table?
0
PortletPaulfreelancerCommented:
sorry, I'm not clear

is the table: IAPRT#
and the field to sort by: IARCC9
when you say blank do you mean NULL or is it an "empty string"?

& I don't see information on how a third table joins to either of the existing tables

SELECT
       ItQty#
     , IhDocd
     , ItPRT#
FROM pklib.Fileout1 a
INNER JOIN astdta.icEct1 b ON b.CtCom# = a.ItCom#
     AND b.CtCtr# = ' '
     AND b.CtPrt# = a.ItPrt#

INNER JOIN IAPRT# ON ?????????????????
AND IAPRT#.IARCC9 is not null -- is not blank
AND IAPRT#.IARCC9 <> '' -- is not an "empty string"
     
ORDER BY a.ItPRT#, IAPRT#.IARCC9 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.