gunapriyan
New member
- Local time
- Tomorrow, 04:06
- Joined
- May 26, 2010
- Messages
- 5
Dear Pals,
I have a table named "Payment". It contais the following stucture.
Emp_Name
Emp_Category
Plucked_Date
Rate_of_Wages
Plucked_Days
Sundry_Days
Plucked_Kilos
Plucking_Wages
Sundry_Wages
Incentive_Kilos
Plucking_Incentive
Extra_Hour
Extra_Wages
Sunday_Days
Sunday_Wages
Total_Wages
Advance_Recovery
Total_Payable
The daily entry will fell down into this table…
When I mention 2 days of “Plucked_Days” , it must come single entry for each employee…But now it comes like,
“Guna”, “Dhanush”,”Muthu”, “Karnan” employees came 2 times….I need single time….But I have used distinct……But no result…
Emp_Name
Emp_Category
Plucked_Date
Rate_of_Wages
Plucked_Days
Sundry_Days
Plucked_Kilos
Plucking_Wages
Sundry_Wages
Incentive_Kilos
Plucking_Incentive
Extra_Hour
Extra_Wages
Sunday_Days
Sunday_Wages
Total_Wages
Advance_Recovery
Total_Payable
Guna
Male
Muthu
Female
Dhanush
Female
Karnan
Supervisor
Guna
Male
Muthu
Female
Dhanush
Female
Karnan
Supervisor
To that I have used following query,
SELECT a.emp_name AS Emp_Name, Sum(a.plucked_days) AS SumOfplucked_days, a.rate_of_wages AS rate_of_wages,
Sum(a.sundry_days) AS SumOfsundry_days, Sum(a.plucked_Kilos) AS SumOfplucked_Kilos, a.plucking_wages AS plucking_wages,
a.sundry_wages AS sundry_wages, Sum(a.incentive_kilos) AS SumOfincentive_kilos, Sum(a.plucking_incentive) AS SumOfplucking_incentive, Sum(a.extra_hour) AS SumOfextra_hour, Sum(a.extra_wages) AS SumOfextra_wages, a.sunday_wages AS sunday_wages,
Sum(a.total_wages) AS SumOftotal_wages, Sum(a.advance_recovery) AS SumOfadvance_recovery, Sum(a.total_payable) AS SumOftotal_payable
FROM (SELECT b.emp_name FROM (SELECT DISTINCT emp_name FROM payment GROUP BY emp_name) AS b GROUP BY b.emp_name)
AS c INNER JOIN payment AS a ON c.emp_Name=a.emp_Name
WHERE a.plucked_date between cdate('22/05/2010') and cdate('23/05/2010')
GROUP BY a.emp_Name,a.rate_of_wages, a.plucking_wages, a.sundry_wages, a.sunday_wages;
I am waiting for your nice reply.
Thanks in advance..
Yours
GUNA…..
I have a table named "Payment". It contais the following stucture.
Emp_Name
Emp_Category
Plucked_Date
Rate_of_Wages
Plucked_Days
Sundry_Days
Plucked_Kilos
Plucking_Wages
Sundry_Wages
Incentive_Kilos
Plucking_Incentive
Extra_Hour
Extra_Wages
Sunday_Days
Sunday_Wages
Total_Wages
Advance_Recovery
Total_Payable
The daily entry will fell down into this table…
When I mention 2 days of “Plucked_Days” , it must come single entry for each employee…But now it comes like,
“Guna”, “Dhanush”,”Muthu”, “Karnan” employees came 2 times….I need single time….But I have used distinct……But no result…
Emp_Name
Emp_Category
Plucked_Date
Rate_of_Wages
Plucked_Days
Sundry_Days
Plucked_Kilos
Plucking_Wages
Sundry_Wages
Incentive_Kilos
Plucking_Incentive
Extra_Hour
Extra_Wages
Sunday_Days
Sunday_Wages
Total_Wages
Advance_Recovery
Total_Payable
Guna
Male
5/22/2010
116
0
1
0
0
116
0
0
0
0
0
0
116
0
116
Female
5/22/2010
100
1
0
34
100
0
4
2
1
10
0
0
112
0
112
Female
5/22/2010
100
1
0
34
100
0
4
2
0
0
0
0
102
0
102
Supervisor
5/22/2010
120
0
1
0
0
120
0
0
0
0
0
0
120
0
120
Male
5/23/2010
116
0
1
0
0
116
0
0
0
0
0
0
116
0
116
Female
5/23/2010
100
0
1
0
0
100
0
0
0
0
0
0
100
0
100
Female
5/23/2010
100
0
1
0
0
100
0
0
0
0
0
0
100
0
100
Supervisor
5/23/2010
120
0
1
0
0
120
0
0
0
0
0
0
120
0
120
To that I have used following query,
SELECT a.emp_name AS Emp_Name, Sum(a.plucked_days) AS SumOfplucked_days, a.rate_of_wages AS rate_of_wages,
Sum(a.sundry_days) AS SumOfsundry_days, Sum(a.plucked_Kilos) AS SumOfplucked_Kilos, a.plucking_wages AS plucking_wages,
a.sundry_wages AS sundry_wages, Sum(a.incentive_kilos) AS SumOfincentive_kilos, Sum(a.plucking_incentive) AS SumOfplucking_incentive, Sum(a.extra_hour) AS SumOfextra_hour, Sum(a.extra_wages) AS SumOfextra_wages, a.sunday_wages AS sunday_wages,
Sum(a.total_wages) AS SumOftotal_wages, Sum(a.advance_recovery) AS SumOfadvance_recovery, Sum(a.total_payable) AS SumOftotal_payable
FROM (SELECT b.emp_name FROM (SELECT DISTINCT emp_name FROM payment GROUP BY emp_name) AS b GROUP BY b.emp_name)
AS c INNER JOIN payment AS a ON c.emp_Name=a.emp_Name
WHERE a.plucked_date between cdate('22/05/2010') and cdate('23/05/2010')
GROUP BY a.emp_Name,a.rate_of_wages, a.plucking_wages, a.sundry_wages, a.sunday_wages;
I am waiting for your nice reply.
Thanks in advance..
Yours
GUNA…..