MySQL 视图 第1349号错误解决方法
程序员文章站
2023-11-30 09:33:16
复制代码 代码如下: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数据库远程访问设置方法
推荐阅读
-
mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法
-
MySQL 1303错误的解决方法(navicat)
-
mysql中异常错误ERROR:2002的解决方法
-
MySQL错误代码1862 your password has expired的解决方法
-
MySQL 1067错误解决方法集合
-
MySQL 视图 第1349号错误解决方法
-
mysql 发生系统错误1067的解决方法
-
浅析Mysql 数据回滚错误的解决方法
-
MySQL无法读表错误的解决方法(MySQL 1018 error)
-
Mysql错误:Too many connections的解决方法