花了8个小时检查这个问题,但没有任何结果,有人能说错了吗?
>SELECT id FROM posts AS post_id;SET categories.id AS category_id;
>SELECT title, contents, date_posted, categories, name FROM posts INNER JOIN
>categories ON categories, id = posts, cat_id ORDER BY id DESC
出现错误 $ #1193 - 未知的系统变量“id”
我也尝试过这样的事情:
>SELECT id FROM posts AS post_id;
>SELECT id FROM categories AS category_id;
>SELECT COALESCE (title, contents, date_posted, categories, name)
>FROM posts INNER JOIN categories ON categories, id = posts, cat_id
>ORDER BY id DESC
还有很多其他员工无法正常工作。
工作查询:
>SELECT posts . p_id AS post_id, categories . c_id AS category_id,
>title, contents, date_posted, categories . name
>FROM posts
>INNER JOIN categories ON categories . c_id = posts . cat_id
>ORDER BY posts.p_id DESC;
最佳答案
尝试将数据库中的变量名 id 更改为其他名称。 id 是保留名称。
关于mysql - #1193 - 未知系统变量 'id',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31743333/