troubleshooting Question

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

Avatar of jeffbarbacpa
jeffbarbacpa asked on
MySQL ServerMicrosoft SQL Server 2008SSRS
2 Comments1 Solution291 ViewsLast Modified:
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')
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
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 2 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