hello all,
I have two tables related to employee and his ratings....
Table: Employee
-----------------------
TokenID (pk)
Division
Post
Table: PmRating
-----------------------
SerialNO
TokenID (FK)
H1
In this organization there are 5 Posts
Some division may have all 5 , some may have less..
EL
M
O
PUL
PGL
When i give a sql query:
SELECT Avg(PMRating.H1) AS AvgOfH1, Employee.Post, Count(Employee.TokenID) AS CountOfTokenID
FROM Employee LEFT JOIN PMRating ON Employee.TokenID = PMRating.TokenID
WHERE (((Employee.Division)='PDRDS'))
GROUP BY Employee.Post;
This is wat I get in return of the sql query
Average_H1 Post Emp_Count
----------------------------------------
4.3 M 12
0.0 O 14
3.4 PUL 10
4.5 PGl 10
What I need is that it should display all bands even if in that division there is no employee for a particular 'Post' ( in the above example 'EL' is missing in the 'Post' field because there is no employee at the EL post for this PDRDS division).
In short I would like to see the average ratings of a division grouped by the Post levels, but for all posts in the organization, even if there is no employee at that post.
Something like this.
Average_H1 Post Emp_Count
------------------------------------------
0.0 EL 0
4.3 M 12
0.0 O 14
3.4 PUL 10
4.5 PGl 10
I have also attached a sample of the data stored in the two tables
i have pasted it in Excel and attached as ZIP....
please do check...I'm in desperate need of help..
I have two tables related to employee and his ratings....
Table: Employee
-----------------------
TokenID (pk)
Division
Post
Table: PmRating
-----------------------
SerialNO
TokenID (FK)
H1
In this organization there are 5 Posts
Some division may have all 5 , some may have less..
EL
M
O
PUL
PGL
When i give a sql query:
SELECT Avg(PMRating.H1) AS AvgOfH1, Employee.Post, Count(Employee.TokenID) AS CountOfTokenID
FROM Employee LEFT JOIN PMRating ON Employee.TokenID = PMRating.TokenID
WHERE (((Employee.Division)='PDRDS'))
GROUP BY Employee.Post;
This is wat I get in return of the sql query
Average_H1 Post Emp_Count
----------------------------------------
4.3 M 12
0.0 O 14
3.4 PUL 10
4.5 PGl 10
What I need is that it should display all bands even if in that division there is no employee for a particular 'Post' ( in the above example 'EL' is missing in the 'Post' field because there is no employee at the EL post for this PDRDS division).
In short I would like to see the average ratings of a division grouped by the Post levels, but for all posts in the organization, even if there is no employee at that post.
Something like this.
Average_H1 Post Emp_Count
------------------------------------------
0.0 EL 0
4.3 M 12
0.0 O 14
3.4 PUL 10
4.5 PGl 10
I have also attached a sample of the data stored in the two tables
i have pasted it in Excel and attached as ZIP....
please do check...I'm in desperate need of help..