php - selecting the data between two date -


i trying select price between 2 date (star date , end date). in database have fixed price this:

2013-05-01 2013-05-31  price: 300 2013-06-01 2013-06-30  price: 200 2013-07-01 2013-07-01  price: 250 

i user selects date between these 3 able generate result doing

sdate>='2013-05-01'  , edate <='2013-05-31'`.  

but if user selects date 2013-05-28 2013-06-03 should 2 days price (300) may month , 3 days price (200) month june. how can achieve this?

try this

 select price tablename sdate >= '2013-05-01' , edate <= '2013-05-31' 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -