I would like to return a rows that have a column which values are between 80 and 91.
Here's my query:
SELECT
SUM(
CASE
WHEN ROUND((offer_percent*100),1) > 90 THEN 1
ELSE 0 END) AS MoreThan90,
SUM(
CASE
WHEN 80 < ROUND((offer_percent*100),1) < 91 THEN 1
ELSE 0 END) AS LessThan90
FROM
approval_state
WHERE
id IN ($id)
and the output is:
MoreThan90 | LessThan90
1 10
I'm expecting then LessThan90 to return only 2 records but it returns 10, which is the total number of records in the table.
Any idea how I can 2 records for LessThan90 only?
Thanks