range - sql between for DAYSOFWEEK -


I have generalized search where I am looking at the average values ​​for different days of the week. The problem is that I'm not sure how to ask for a weird limit 1-7 works fine, (Monday-Sunday), but if a user passes on a Tuesday on Sunday ... i.e. 7-2 does not.

1-7 (1,2, 3,4,5,6,7) 7-2 (7,1,2)

etc.

How can I do more than one limit which is more intelligent or something as date (date), bookdata, AVG (price) as availbab item (item_id = 16 And between DAYOFWEEK (Bookdet) and 7) Group by DAIFEE (Bookdate)

Probably what you want is the syntax:

  SELECT item_id, DAYOFWEEK (bookdate) as the date, bookdate, AVG (price) as the price 'availables' from WHERE (item_id = 16 and DAYOFW EEK (bookdate) IN (7,1,2) Group to Dufofic (bookdet)  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -