SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Location
    San Jose, CA
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error 1066 (42000) Not unique table/alias

    I've found other refs to the Error 1066, but none that seem to address the issue I'm having.
    (I am running MySQL server version 5.0.22)

    The "SELECT" version of the query works as expected:

    SELECT SnippetRating.*, Snippet_Raters.*, SnippetComments.*, SNIPPETS. * FROM (SNIPPETS LEFT JOIN SnippetRating ON SNIPPETS.ID = SnippetRating.Snippet_ID) LEFT JOIN SnippetComments ON SNIPPETS.ID = SnippetComments.Snippet_ID LEFT JOIN Snippet_Raters ON SNIPPETS.ID = Snippet_Raters.Snippet_ID AND Snippet_Raters.Snippet_ID = SNIPPETS.ID WHERE SNIPPETS.ID = 34;


    However, the "DELETE" version (below) gives ERROR 1066 (42000): Not Unique table/alias: 'SnippetRating'


    DELETE SnippetRating.*, Snippet_Raters.*, SnippetComments.*, SNIPPETS. * FROM SnippetRating, Snippet_Raters, SnippetComments, SNIPPETS LEFT JOIN SnippetRating ON SNIPPETS.ID = SnippetRating.Snippet_ID) LEFT JOIN SnippetComments ON SNIPPETS.ID = SnippetComments.Snippet_ID LEFT JOIN Snippet_Raters ON SNIPPETS.ID = Snippet_Raters.Snippet_ID AND Snippet_Raters.Snippet_ID = SNIPPETS.ID WHERE SNIPPETS.ID = 34;



    Any idea what could be going wrong in the DELETE version? (I'm scratching my head!)

    Thanks,

    Charlie

  2. #2
    SitePoint Addict Mal Curtis's Avatar
    Join Date
    Jul 2009
    Location
    New Zealand
    Posts
    327
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    You're using SnippetRating twice...

    FROM SnippetRating, Snippet_Raters, SnippetComments, SNIPPETS LEFT JOIN SnippetRating

  3. #3
    SitePoint Member
    Join Date
    Feb 2010
    Location
    San Jose, CA
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ack -- that's it!

    Thanks so much!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •