Link to home
Create AccountLog in
Avatar of Trent Adams
Trent Adams

asked on

SQL Query Syntax - Certain Rows Being Returned Multiple Times

I have an SQL store procedure that is being crazy for lack of better words. I doesn't seem to matter how I structure the joins, certain rows are being repeated a couple hundred times. Originally the stored procedure utilized all LEFT JOIN, however, I've been attempting to get this working by using a mixture of INNER and LEFT JOIN. Entries that are listed as HOURS will and an IndID, Expenses will have an IndID of -1.  The repeated issue you will observe the 425508 TimeCardID repeating.Please find attached the SP and screenshot.spr_payroll.txtUser generated image
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Trent Adams
Trent Adams

ASKER

You were absolutely correct. A co-worker of mine also suggested to pick a claim and add joins 1-by-1 until I find the error. Which when I took another look at these joins when performing the 1-by-1 I realized that someone other than myself had joined a table alias on itself which was the cause of the issue. Thank you for your assistance.