• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

Need Help with SQL Statment

I am running this sql statement.  I need the 3 records from the openitems table and I need the incodedesc from the incomecodeheader table.  I should see 3 records with the correct description.  Problem is the records are duplicating several times rather than just showing the 3 records with the incode decsription.

Code is attached

SELECT a.Propertyid,a.bldgid,a.unitid,a.resiid,a.inccode,a.originalamt,a.baldue,a.itemduedate,
 b.inccodedesc FROM openitems a left join incomecodeheader b on
 a.inccode = b.inccode WHERE a.propertyid ='WG' and a.bldgID = 'wg' 
and a.unitID='1903003' and a.resiID='2'

Open in new window

1 Solution
mgmhicksAuthor Commented:
this is the solution

SELECT a.Propertyid,a.bldgid,a.unitid,a.resiid,a.inccode,a.originalamt,a.baldue,b.inccode,b.inccodedesc
FROM openitems as a inner join incomecodeheader b on a.inccode=b.inccode WHERE a.propertyid ='WG' and a.bldgID = 'wg'
and a.unitID='1903003' and a.resiID='2' and b.propertyid = 'wg'
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now