...

View Full Version : join syntax for table.column



turpentyne
12-06-2011, 05:24 AM
I'm trying to join a couple tables that have the same column name. I want to do something like:


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?

sunfighter
12-06-2011, 06:09 PM
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.


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

Old Pedant
12-06-2011, 09:38 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum