Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    405
    Thanks
    17
    Thanked 2 Times in 2 Posts

    join syntax for table.column

    I'm trying to join a couple tables that have the same column name. I want to do something like:

    PHP Code:
    SELECT *
    FROM table1
    JOIN continents
    .Name AS continentname ON table1.continents continents.ID 
    But I'm getting an error:
    command denied to user 'username'@'localhost' for table 'Name'

    Is this not a possible way of doing my query?

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,085
    Thanks
    23
    Thanked 593 Times in 592 Posts
    You really don't say what you want from the two tables. This one produces only the set of records that match in both Table1 and name.

    Code:
    SELECT * FROM Table1
    INNER JOIN Name
    ON table1.continents = Name.continents

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Why do you think MySQL would lie to you about the error??

    That error surely means exactly what it says.

    The default user (username@localhost) simply doesn't have permission to access that table in that database.

    To find out for sure, just try getting something from that table, without using a JOIN.

    You should get the same message.

    So now you need to go add username@localhost as an account with permissions to that database and/or table.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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