I have the following array of price ranges how can I perform a query to find the price range between these using and operator
This is the array I have
["0-1000", "5001_15000", "15001_25000"]
Whether this is the only way I have to perform else is ther any methods to perform such filter
select * from posts where price between 0 and 1000 and price between 5001 and 15000
Edit-1
As your said I tried in my console
a = [[0,1000],[5001 ,15000], [15001, 25000]]
(a[0].first..a[0].last)
This gives 0..1000
and when I try
(a[0].first..a[0].last and a[1].first..a[1].last)
It shows only 5001..15000
can you explain it please.
Edit-2
Only this works how can I add more values
Post.where(price: a[0].first..a[0].last)