title: SQL Using Distinct returning Duplicates records
body: <p>I am trying to execute following query. I a expecting no duplicates should be come. but in the result set i am getting duplicates records. I am new to sql.</p>
  
  <pre><code>SELECT DISTINCT pr.id as ruleid, pr.alias as rulename,grp.id as groupId, grp.alias, fgp.filterGroupType FROM  ProcessingService s    INNER JOIN s.fileGroupingParameter fgp ON fgp.status =:fileGroupStatus INNER JOIN s.svcPathList path ON path.status =:pathStatus  INNER JOIN path.policy p  ON p.status =:policyStatus  INNER JOIN p.policyGroupRelSet pgr  INNER JOIN pgr.group grp ON grp.status =:groupStatus  INNER JOIN grp.policyGroupRuleRelSet rr  INNER JOIN rr.policyRule pr  ON pr.status =:ruleStatus  INNER JOIN pr.policyActionSet pa ON pa.status =:actionStatus WHERE s.id in (:idList) AND pa.action =:actionType AND s.status =:serviceStatus AND fgp.filterGroupType ='Rulewise' AND pr.category =:reasonCategory AND pr.severity =:reasonSeverity
  </code></pre>
  
  <p>how i can get distinct records as per my requirement.</p>
  
  <p>The result set I am getting is </p>
  
  <pre><code>"policy rule1"   
  "policy rule1"  
  "policy rule12"  
  "policy rule12"
  </code></pre>
  
  <p>and I want:</p>
  
  <pre><code>"policy rule1"  
  "policy rule12" 
  </code></pre>
  
  <p>as output.</p>