Hi All, I am new to sql and also this is my first post in this THREAD, Inline with this I am going to improve knowledge on sql, so below is my query which i desperately needed and don't know it is possible or not?
I've Two table
Table1: ProblemGroup columns: ProblemCode (19 rows),Problem description (19 rows)
Table2: Complaints Columns: No. of Complaints,Downtime,GroupCode,Vert_id.
Here is what I want
First the table should have
1. the columns : ProblemCode,Problemdescription,Count(No.of Complaints),sum(Downtime)
2. the problemCode and ProblemDescription rows (19) should not vary with the "WHERE CONDITION"
for example:
I've written the below Query
select Count(No. of Complaints), sum(Downtime),P.ProblemCode, P.ProblemDescripton from Complaints c Right Outer Join problemgrp P On C.GROUPCode=P.PROBLEMGRPCode
Group by GROUPCode,PROBLEMGRPCode,DESCRIPTION
Here the result is showing 19 rows
but when writing like this
select Count(No. of Complaints), sum(Downtime),P.ProblemCode, P.ProblemDescripton from Complaints c Right Outer Join problemgrp P On C.GROUPCode=P.PROBLEMGRPCode where Vert_ID='utg' Group by GROUPCode,PROBLEMGRPCode,DESCRIPTION
when writing like this i am getting only 14 rows,
Moral is: Even if I used the filters(like Vert_ID). There should NOT BE change in rows ProblemCode and ProblemDescription (i.e the rows of problemCode and ProblemDescription columns should not vary with the where conditions)
Please help in wirtiing the code