“只允许SELECT查询”错误

时间:2017-02-27 14:48:32

标签: mysql sql

我正在学习sql。我参加了几门课程,所以我开始用实际数据库培训实际情况。我正在使用Supermetrics来查询wordpress mysql数据库。我写了以下请求:

Select wp_users.user_nicename,
wp_users.display_name,wp_10_posts.post_title,wp_10_posts.post_author,wp_10_posts.post_date
from wp_10_posts
Inner join wp_users
on wp_10_posts.post_author=wp_users.ID
ORDER BY wp_10_posts.post_date DESC;
limit 150

我有以下错误:"Only SELECT queries allowed"

2 个答案:

答案 0 :(得分:4)

错误的;位置。 ;必须位于查询的末尾,否则LIMIT 150将用作新的sql命令

  Select 
      wp_users.user_nicename
      ,wp_users.display_name
      ,wp_10_posts.post_title
      ,wp_10_posts.post_author
      ,wp_10_posts.post_date
  from wp_10_posts
  Inner join wp_users on wp_10_posts.post_author=wp_users.ID
  ORDER BY wp_10_posts.post_date DESC 
  limit 150; 

答案 1 :(得分:3)

现在应该工作!将分号移到查询的末尾....

Select wp_users.user_nicename,
wp_users.display_name,wp_10_posts.post_title,wp_10_posts.post_author,wp_10_posts.post_date
from wp_10_posts
Inner join wp_users
on wp_10_posts.post_author=wp_users.ID
ORDER BY wp_10_posts.post_date DESC
limit 150;