Search code examples
mysqlsequelpro

Error when try to create a VIEW in MySQL


I like Sequel Pro to handle MySQL databases on Mac. Now I'm triying to create a view with this:

CREATE VIEW '_view_userlist' AS 
SELECT u.userid,u.fullname,u.username,e.userid,e.listid,e.title,e.status 
FROM users u 
LEFT OUTER JOIN list e ON e.userid=u.userid 
WHERE u.status=1 AND e.status=1 
ORDER BY e.title ASC

But I get this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''_view_userlist' AS 
SELECT u.userid,u.fullname,u.username,e.userid,e.listid,e.t' at line 1

I'm no sure what really means. When a I try the request without the CREATE VIEW line all goes smooth.

I have MySQL 5.5.35. Any help o advise ??


Solution

  • change

    CREATE VIEW '_view_userlist' AS 
    

    as

    CREATE VIEW `_view_userlist` AS 
    

    or

    CREATE VIEW _view_userlist AS 
    

    DEMO