需要有关周显示查询的建议

时间:2014-01-24 06:03:09

标签: php mysql wordpress wordpress-plugin

需要有关如何在周显示此查询的建议。

我想显示每周基本的结果。所以它挑选随机系列并打印出来。

function series_list() {
        global $wpdb;
            $select = "SELECT
                    c.id as id,
                    c.title as series_name,
                    c.slug as series_slug,
                    c.title as title,
                    c.slug as slug,
                    a.slug as latest_slug,
                    a.pubdate as last_update,
                    c.chapterless as chapterless,
                    c.status as status
                    FROM `".$wpdb->prefix."comic_chapter` a,
                    (SELECT series_id, max(number) as number
                    FROM `".$wpdb->prefix."comic_chapter`
                    GROUP BY series_id) b, 
                    `".$wpdb->prefix."comic_series` c
                    WHERE b.series_id = a.series_id AND b.number =   a.number AND b.series_id = c.id

                ORDER BY RAND()";
            $results = $wpdb->get_results( $select );

0 个答案:

没有答案