Quote:
|
Originally Posted by I like pie
and i'm back again already... i don't mean to ask for others to write my code but i've been reading about table joins for about an hour or two and i'm just getting more confused
ok...
so i have a players table, let's say for now that a row looks like this:
id, name, cash, equipped, str
now there's a weapons table:
id, name, str, description
so... when a player equips let's say... a staff, it would update his equipped field to "staff" and his str field would be the sum of his own str value plus the value in the staff's str field
the only way i can think to do it is to get the weapon str in one query, and assign the value to a variable, and then use that in another query. but that seems really sloppy
i'm entirely lost as to how this query should look, any ideas?
|
thats simple. Personally I dont use joins. You can do this using basic sql.
select p.id, p.name, p.cash, p.str, w.id as w_id, w.name as w_name, w.description as w_description
from players p, weapons w
where p.equipped = w.id
You will then get these fields:
id, name, cash, str, w_id, w_name, w_description
Returned from a single query.