[wp-hackers] Hacking Assignment: Paging by Days
Sebastian Herp
newsletter at scytheman.net
Sat Sep 4 21:51:48 UTC 2004
Not a solution ...
But, the solution would be very simple if things like subqueries were
allowed. Are they? That would require mysql 4.1 running everywhere ...
what apparently isn't the case (only having 4.0.15 myself)...
Just a quick "hack" without testing, but something like this should do
it, right?
SELECT * FROM 'wp_posts' WHERE
(year(post_date),month(post_date),dayofmonth(post_date)) = (SELECT
year(post_date),month(post_date),dayofmonth(post_date) FROM `wp_posts`
GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER
BY post_date DESC LIMIT 0,5)
Greetings
P.S.: It is a shame that nobody at mysql.com thought about subqueries
and procedures in sub-4-versions ...
Ryan Boren wrote:
>As I mentioned in reply to Podz' mail, the code for paging by days is
>very simple-minded. It divides the query up into blocks of days.
>However many posts there are in that block, if any, are displayed. What
>most people expect to happen when they ask that posts be paged by 5 days
>is that 5 "days worth" of posts be displayed. This is a more
>complicated query. Actually, it can be multiple queries. Anyone want
>to take this on? You might be able to make use of ScriptyGoddess'
>Next/Previous Archive Date code for finding the next day that has a
>post.
>
>
>
More information about the hackers
mailing list