Reputation: 381
i have a question about a value equal or greater than value from other table. what i am trying to do is to check in the characters fulfills the requirements in Agi that talents has. in this situation the R_Agi for the talent is 30. so i tried to do this:
SELECT character_.Name_, character_.Agi, Talents.R_Agi, Talents.SkillName
FROM character_, Talents
WHERE character_.Agi >= 30
AND Talents.SkillName = 'ambidextrous';
but when i change WHERE character_.Agi >= 30 so some smaller value it will also list character when lower than 30. and i only want to show the ones that are = or greater than 30.
after that i tried to do this:
SELECT character_.Name_, character_.Agi, Talents.R_Agi, Talents.SkillName
FROM character_, Talents
WHERE Talents.SkillName = 'ambidextrous'
AND character_Agi >= talents.R_Agi;
but get an error:
Error Code: 1054. Unknown column 'character_Agi' in 'where clause'
what would you suggest that i do?
Upvotes: 1
Views: 45
Reputation: 4350
Where is the join for those 2 tables in first query?
FROM character_, Talents
And try to use explict joins and not enumering all tables at the from clause.
And you missed a "." in the join at the second query.
Upvotes: 1
Reputation: 23992
You have the column qualifier missing.
Change:
AND character_Agi >= talents.R_Agi;
To:
AND character_.Agi >= talents.R_Agi;
Upvotes: 1
Reputation: 4173
I think you're missing a .
in the last line
SELECT character_.Name_, character_.Agi, Talents.R_Agi, Talents.SkillName
FROM character_, Talents
WHERE Talents.SkillName = 'ambidextrous'
AND character_.Agi >= talents.R_Agi;
Upvotes: 3