How to solve the error of MySQL view 1,349th

Source: Internet
Author: User

CopyCode The Code is as follows: 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;

Error 1349 (hy000): View's select contains a subquery in the from clause
Is this a bug? See http://bugs.mysql.com/bug.php? Id = 16757

I had to change it like this:

Copy code The Code is as follows: 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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.