MySQL 视图 第1349号错误解决方法
程序员文章站
2023-08-13 17:45:04
复制代码 代码如下:create or replace view blog_v_admin (id,nickname,s...
复制代码 代码如下:
create or replace view blog_v_admin
(id,nickname,sex,email,phone,qq,msn,http,register_time,
ip,last_login_ip,login_time)
as
select
a.id,a.nickname,a.sex,a.email,a.phone,a.qq,a.msn,a.http,a.register_time,
b.ip as last_login_ip,b.login_time as last_login_time
from
blog_admin a left join
blog_admin_login_track b on b.admin = a.id left join
(select admin,max(login_time) as login_time from blog_admin_login_track group by admin) c on b.admin = c.admin;
这是bug吗?见:http://bugs.mysql.com/bug.php?id=16757
木有办法,我只好这样改了:
复制代码 代码如下:
create or replace view blog_v_admin
(id,nickname,sex,email,phone,qq,msn,http,register_time,
login_time,last_login_ip)
as
select
a.id,a.nickname,a.sex,a.email,a.phone,a.qq,a.msn,a.http,a.register_time,
(select login_time from blog_admin_login_track where admin = a.id order by login_time desc limit 1) as last_login_time,
(select inet_ntoa(ip) from blog_admin_login_track where admin = a.id order by login_time desc limit 1) as last_login_ip
from
blog_admin a;
推荐阅读
-
mysql服务无法启动报错误1067解决方法(mysql启动错误1067 )_MySQL
-
ORA-27101,ORA-27102 错误解决方法_MySQL
-
Adobe Dreamweaver CC MySQL连接 报404错误的解决方法_MySQL
-
PHP错误Warning:mysql_query()的解决方法
-
MySQL出现SQL Error (2013)连接错误的解决方法_MySQL
-
PHP错误Warning:mysql_query()的解决方法
-
Mysql 数据库更新错误的解决方法
-
navicat连接mysql出现2059错误的解决方法
-
MySQL 1594错误解决方法_MySQL
-
MySQL之——提示"mysql deamon failed to start"错误的解决方法