Try using the CASE statement
select count(case when sal between 0 and 1000 then 1 end) count(case when sal between 1000 and 10000 then 1 end) , count(case when sal between 10000 and 100000 then 1 end) from user_details;
Note : you also have an else keyword that can be placed at the end (if necessary)
For example, see 1. here
2. It meets your requirements.
source share