0

Hi All,

What Wrong with my QUERY ! it show Repetition of Record in INNER Join i.e when i have 3 record in database it show it 9 time using This query....

SELECT     
    dbo.EmployeeSetup.EmpID, dbo.EmployeeSetup.EmpName, dbo.EmployeeSetup.FatherName, dbo.EmployeePayment.Designation,
    dbo.EmployeePayment.Department, dbo.EmployeePayment.Salary, dbo.EmployeePayment.Advance, dbo.EmployeePayment.Deduction,
    dbo.EmployeePayment.OvertimeAmount, dbo.EmployeePayment.PaymentDate, dbo.EmployeePayment.ModeOfPayment,
    dbo.EmployeePayment.NetPay, dbo.EmployeePayment.PayMonth, dbo.EmployeePayment.Fine, dbo.EmployeePayment.Fund,
    dbo.EmployeePayment.Insurence, dbo.EmployeePayment.Tax, dbo.tblAllownce.MedicalAllownce, dbo.tblAllownce.DailyAllownce,
    dbo.tblAllownce.TravellingAllownce, dbo.tblAllownce.OtherAllownce, dbo.EmployeeSetup.Salary AS BasicSalary,
    dbo.EmployeeSetup.JoiningDate, dbo.EmployeePayment.PayDateFor
FROM         
    dbo.EmployeePayment 
INNER JOIN
    dbo.EmployeeSetup 
    ON dbo.EmployeeSetup.EmpID = dbo.EmployeePayment.EmpID 
INNER JOIN
    dbo.tblAllownce 
    ON dbo.EmployeeSetup.EmpID = dbo.tblAllownce.EmpID

Edited by pritaeas: Added markdown.

3
Contributors
10
Replies
32
Views
4 Years
Discussion Span
Last Post by diafol
0
 ON dbo.EmployeeSetup.EmpID = dbo.EmployeePayment.EmpID 

Don't know if it will make a diff

 ON dbo.EmployeePayment.EmpID  = dbo.EmployeeSetup.EmpID 
0

select * from tblAllownce

1 2013-06-29 Fend-IT-001 Khair Ullah Software Developer IT 0 0 0 0 0 June-2013
2 2013-06-29 Fend-IT-001 Khair Ullah Software Developer IT 0 0 0 0 0 May-2013

select * from EmployeeSetup

3 Fend-HR-003 001-IT Ahmad Abid Male BS(CS) 6 Months Accountant Dir -6533329 1992-02-01 234344443 tufail@yahoo.com Dir Pakistani Islam uiyuyuu Married erererr 2013-06-25 08:00:00 34565.00
1 Fend-IT-001 001-IT Khair Ullah Rehan Male BS(CS) 1 Year Software Developer Peshawar -4195-599 - 1989-03-01 3469184015 khairullah_swat@yahoo.com Swat Pakistani ISLAM Swat Unmarried Pashtu 2013-02-15 08:00:00 13000.00
2 Fend-IT-002 001-HR Tufail Ahmad Zaman Male BS(CS) Less Then 6 Months S W Dev Dir -1698385 1990-01-01 3139020637 tufailahmad29@yahoo.com Dir Lower Pakistani Islam Dir Married Pushto 2012-02-01 08:00:00 100000.00

select * from tblAllownce

1 2013-06-29 Fend-IT-001 Khair Ullah Software Developer IT 0 0 0 0 0 June-2013
2 2013-06-29 Fend-IT-001 Khair Ullah Software Developer IT 0 0 0 0 0 May-2013

0

Are you running this via phpMyAdmin or via php?

Try it in phpMyAdmin to see how many records you get. You say you only have 3 in the first table?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.