T
T
Timofey Sergeev2018-04-02 14:30:15
MySQL
Timofey Sergeev, 2018-04-02 14:30:15

I can't formulate mysql query by date, what's wrong?

There is a task - to display three posts with the minimum number of views for the period from 7 to 30 days from today.
I write a query like this ("SELECT ID, post_title, post_excerpt FROM wp_posts WHERE post_status = 'publish' AND
DATE(post_date) BETWEEN DATE(DATE_ADD(NOW(), INTERVAL -7 DAY)) AND DATE(DATE_ADD(NOW(), INTERVAL -1 MONTH))
AND post_type='post' ORDER BY views_count LIMIT 0,$posts_on_cullum")
But it returns only the id of the first post, what could be wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question