I have 3 mysql tables show below. in this case, tbl_a is join table relating tbl_b and tbl_c. I would like to denormalize tbl_a
tbl_a schema
b_id, c_id, id, x,y,z
tbl_b schema
id, a, b, c
tbl_c schema
id, d, e, f
The idea is that for each id in tbl_a, I want to replace b_id and c_id with the full entries from their respective tables.
I have the query
select a,b,c,d,e,f,x,y,z from tbl_a
INNER JOIN tbl_b on tbl_a.b_id = tbl_b.id
INNER JOIN tbl_c on tbl_a.c_id = tbl_c.id;
But this results in 2 rows for each id in tbl_a.
Can someone explain why this doesn’t work?
any chance to have duplicate id’s in tbl_a?
the query is correct – check http://sqlfiddle.com/#!8/9c666/1