Problem With Distinct

Dear Friends,

I have one problem with my database.

I herewith enclose my database for your kind perusal.

In the DB, you may find Payment table and Payment Query.

The daily entry will fell down into Payment Table.

After oneweek end user select 2 days (1Week Time). The Result must display with consolidation.

You may found that in my DB.....(Payment Query)

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;

But My result is wrong......Problem with distinction...

So please fix that error and do the needful to me...

I am waiting for your nice reply.

Thanks in advance..

Yours
GUNA

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion