Reputation: 23
I've been messing about with MySQL for a while, got all my db setup and now I'm trying to join the tables together with InnerJoin, but I keep getting this "Unknown column on clause" error, tried googling but my code seems to be right.
Here's what the query looks like:
select
CharacterName, ClassName, PerkName
FROM
rpgcharacter
INNER JOIN
class ON rpgcharacter.idClass = class.idClass
inner join
perks on rpgcharacter.idRPGCharacter = perklist.idRPGCharacter;
Error
Code: 1054. Unknown column 'perklist.idRPGCharacter' in 'on clause'
Upvotes: 1
Views: 405
Reputation: 23
Ahhh I see what I was doing wrong, apparently since I had not previously compared or even mentioned the query could not find the table, this is the solution I found.
select
rpgcharacter.CharacterName, class.ClassName,
perks.PerkName, skills.SkillName
from
perklist
inner join
rpgcharacter on perklist.idRPGCharacter = rpgcharacter.idRPGCharacter
inner join
class on rpgcharacter.idClass = class.idClass
inner join
perks on perklist.idPerks = perks.idPerks
inner join
skilllist
inner join
skills on skilllist.idSkill = skills.idSkills
and skilllist.idRPGCharacter = rpgcharacter.idRPGCharacter
where
perklist.idRPGCharacter = 3
Upvotes: 1