Thursday, 12 September 2013

Combining multiple sql statements

Combining multiple sql statements

I have two tables. Let's call them weapons and weapon_powers.
Weapons has ID (primary)
weapon powers has ID (primary) and WEAPONTYPE.
WEAPONTYPE is the ID of the weapon the power is assigned to.
A power equipped on weapon 1 would have a weapontype of 1.
How do I combine these two statements into one?
select * from weapons where ID = somevariable
select * from weapon_powers where WEAPONTYPE = somevariable

No comments:

Post a Comment