mysql - Joining two tables but getting no result -
table1
move1 move2 fire ice grass fire ice grass
table2
move power fire 40 grass 30 ice 20
i have these 2 tables, when run sql statement in wampserver, no rows returned:
select * table1, table2 inner join table1 hello on hello.move1 = table2.move inner join table1 meow on meow.move2 = table2.move
both tables under same database, can't see error. want return like...
table1
move1 move2 move power move power fire ice fire 40 ice 20 grass fire grass 30 fire 40 ice grass ice 20 grass 30
where did go wrong?
this should work:
select m.move1, m.move2, m1.move, m1.power, m2.move, m2.power table1 m join table2 m1 on m1.move = m.move1 join table2 m2 on m2.move = m.move2
you can test in sql fiddle
Comments
Post a Comment