如何在此查询中获取行号

时间:2018-06-29 09:50:13

标签: sql wordpress

我有以下WP_Query($arg)

$arg = array(
    'post_type' => 'ma_novel',
    'post_status'=>'fn_publish',
    'posts_per_page' => 10,
    'order' => 'DESC',
    'orderby' => 'meta_value_num',
);

执行此SQL:

SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)
WHERE 1=1
  AND (wp_postmeta.meta_key = 'ma_rating')
  AND wp_posts.post_type = 'fn_novel'
  AND ((wp_posts.post_status = 'publish'))
GROUP BY wp_posts.ID
ORDER BY wp_postmeta.meta_value+0 DESC
LIMIT 0,
      10

如何在上述SQL查询中获取帖子ID 108行号?它在wp_posts表中。

0 个答案:

没有答案