Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Badges

alsarg72 newb

About

Username
alsarg72
Joined
Visits
3
Last Active
Roles
Member
Points
7
Badges
2
  • deleting a category

    The problem with the statement is covered in "http://dev.mysql.com/doc/refman/5.5/en/delete.html"...

    ...where it says "Table aliases in a multiple-table DELETE should be declared only in the table_references part of the statement." and the examples immediately below it.

    This is what vanilla is doing.

    mysql> delete GDN_Comment c from GDN_Comment c join GDN_Discussion d on c.DiscussionID = d.DiscussionID where d.CategoryID = "Test";

    ERROR 1064 (42000): 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 'c from GDN_Comment c join GDN_Discussion d on c.DiscussionID = d.DiscussionID wh' at line 1

    This is what it needs to do. The difference is that the table name is not mentioned immediately after delete, only the alias.

    mysql> delete c from GDN_Comment c join GDN_Discussion d on c.DiscussionID = d.DiscussionID where d.CategoryID = "Test";

    Query OK, 0 rows affected (0.00 sec)

    422