Avatar of jeffbarbacpa
jeffbarbacpa
 asked on

SQL query return records even when criteria in one table is not satisfied

I have two tables.  

LN_CODES which has the loan number LNKEY
LN_FEES which is a list of loan fees FEENAME, BORRPART

I want to show the loan number, and the flood fee.  If there is no flood fee I still want to show the loan number, and show either $0 or null as the flood fee.  Here is my current query.  Any help would be appreciated!

SELECT     EMPOWER.U_LN_CODES.LNKEY, EMPOWER.LN_FEES.FEENAME, EMPOWER.LN_FEES.BORRPART
FROM         EMPOWER.U_LN_CODES LEFT OUTER JOIN
                      EMPOWER.LN_FEES ON EMPOWER.U_LN_CODES.LNKEY = EMPOWER.LN_FEES.LNKEY
WHERE     (EMPOWER.U_LN_CODES.LNKEY = '2011-1784433') AND (EMPOWER.LN_FEES.FEENAME = 'Flood')
Microsoft SQL Server 2008SSRSMySQL Server

Avatar of undefined
Last Comment
jeffbarbacpa

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
JestersGrind

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
jeffbarbacpa

ASKER
perfect...thanks!
Your help has saved me hundreds of hours of internet surfing.
fblack61