title: Postgresql - query to get difference in data count
body: <p>I have two tables, today's_table and yeterday's_table.
  I need to compare the data for an interval of 15 mins at exact same times for today and yesterday.</p>
  <p>For example, for below data let's I need to check from 00:00:00 and 00:15:00 on 20201202 and 20201202. So difference should come out as '3' since the yesterday's_table has 8 records and today's_table has 5 records.</p>
  <p>today's_table:</p>
  <p><a href="https://i.stack.imgur.com/gwgZW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gwgZW.png" alt="Date" /></a></p>
  <p>Yesterday's table:</p>
  <p><a href="https://i.stack.imgur.com/wop9M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wop9M.png" alt="enter image description here" /></a></p>
  <p>I tried something like; (consider now() is 00:15:00)</p>
  <pre><code>select count(*) from yeterday's_table where time between now() - interval &quot;24 hours&quot; and now() - interval &quot;23 hours 45 mins&quot;
  minus
  select count(*) from today's_table where time = now() - interval &quot;15 minutes&quot;;
  </code></pre>
  <p>is there any other way to do this?</p>