How to design a query that gives count of different parameters based on different condition from a single table
select sum(case when issue_date = return_date then 1 else 0 end) SAME_DAY,
       sum(case when return_date is null then 1 else 0 end) NOT_RET,
       sum(case when issue_date &lt;&gt; return_date then 1 else 0 end) SEP_DAY
  from books;