title: How to get last 24 hrs data in postgreSQL
body: <p>I want  to get last 24 hrs data. i wrote a query in postgreSQL as follows. But I couldn't get the answer as i expected.  </p>
  
  <pre><code> SELECT startdate::timestamp AS startdate,
      (DATE_PART('hour',startdate::timestamp)::integer) as hrs,count(guorderid)
      FROM ord_entitlement
      WHERE DATE_PART('Day',CURRENT_DATE::timestamp - startdate::timestamp) &lt; 1
      AND DATE_PART('hour',startdate::timestamp) &lt;= 24
      GROUP BY  hrs,startdate
      ORDER BY startdate
  </code></pre>