title: Why Oracle is saying not a GROUP BY expression?
body: <p>I am Trying to retrive data from the Oracle database table with following conditions </p>
  
  <ol>
  <li>All entries found by zip-code should be grouped, sorted by zip-code descending.</li>
  <li>entries found by city should be grouped, sorted alphabetically.</li>
  <li>All entries found by dealername should be grouped, sorted alphabetically.</li>
  </ol>
  
  <p>To staisfy the above conditions I wrote the query like below</p>
  
  <pre><code>SELECT DISTINCT ba.uuid AS uuid
          , COUNT(*) over() AS rowcount 
  FROM basicaddress ba 
  WHERE ba.postalcode='143456' 
  OR ba.lastname LIKE '%143456%' 
  OR ba.city LIKE '%143456%'
  GROUP BY
      CASE WHEN ba.postalcode='143456' THEN ba.postalcode END 
  ORDER BY 
      CASE WHEN ba.postalcode='143456' THEN ba.postalcode END DESC, 
      CASE WHEN ba.lastname LIKE '%143456%' THEN ba.lastname END ASC, 
      CASE WHEN ba.city LIKE '%143456%' THEN ba.city ELSE ba.postalcode END DESC
  </code></pre>
  
  <p>This query is working fine in MYSQL but in oracle it is saying <em>"not a GROUP BY expression"</em></p>
  
  <p>Any help will be greatly appreciated</p>