首先,我使用的MYSQL版本是5.1.66-community-log
。
现在我们已经解决了这个问题,在尝试创建以下视图时,我正在检索以下错误:
SQL语法中有错误;请查看手册
对应于MySQL服务器版本,以便使用正确的语法
接近'all select RRA.id,RRA.reply_id作为replyID,RRA.user_id,
投票,排在第4行
以及观点:
$sql = "Create or replace view userRank as
select PRA.id, PRA.post_id as postID, PRA.user_id, PRA.vote_up, PRA.rank_date
from post_rank_activity PRA
union all
select RRA.id, RRA.reply_id as replyID, RRA.user_id, RRA.vote_up, RRA.rank_date
from reply_rank_activity RRA";
我已经检查了一些网站,这似乎是正确的语法-或者随着时间的推移有什么变化?
最佳答案
圆括号
Create or replace view userRank as
(select PRA.id, PRA.post_id as postID, PRA.user_id, PRA.vote_up, PRA.rank_date
from post_rank_activity PRA)
union all
(select RRA.id, RRA.reply_id as replyID, RRA.user_id, RRA.vote_up, RRA.rank_date
from reply_rank_activity RRA)
关于mysql - 无法创建MYSQL View ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13312597/