ranjan satpathy ranjan satpathy - 4 months ago 15
SQL Question

MySQL to count rows in between two numbers

I want a query to count rows in between two numbers. I have a table called purchase_order and in that there is a column called age, And in that age column simple numeric data is populating like 30, 55, 90, 95, 100....So for example I want only count rows in between 90 to 100. So far I tried this

SELECT * FROM office_in_box.purchase_order WHERE age BETWEEN 90 and 110


Also I want the count of all rows in between 90 to 110.

Thanks

JPG JPG
Answer

Just use COUNT:

SELECT COUNT(*) FROM office_in_box.purchase_order WHERE age  BETWEEN 90 and 110