title: SQL Query works fine in MySQL, but giving error in PostgreSql
body: <p>I am trying to access data from two different databases MySql &amp; PostgreSQL,
  Below query is working in MySql but gives an error</p>
  
  <pre><code>ERROR:  column "sales.item_id" must appear in the GROUP BY clause or be used in an aggregate function
  LINE 2:        sales.item_id,
                 ^
  </code></pre>
  
  <p>when running on PostgreSQL server</p>
  
  <pre><code>SELECT  
         sales.item_id,
         sales.sales_date,
         sales.city_id,
         geography.city,
         geography.state,
         count(quantity) as QTY_SOLD,
         price,
        (cogs * count(quantity)) AS TOTAL_PURCHASE,
        (price * count(quantity)) AS TOTAL_SALES,
        ((price * count(quantity)) - (cogs * count(quantity))) AS PROFIT
         FROM sales JOIN geography ON sales.city_id = geography.city_id
         GROUP BY
         geography.city
         ORDER BY PROFIT DESC;
  </code></pre>
  
  <p>Any suggested correction in written query?</p>