I have data like this table master_item
+-------+---------+ |item_id|item_name| +-------+---------+ | 001 | Car A | | 002 | Car B | +-------+---------+
and relation into table process
+-------+--------+ |proc_id|proc_seq| +-------+--------+ | 001 | 1 | | 001 | 2 | | 001 | 3 | | 001 | 4 | | 001 | 5 | | 002 | 1 | | 002 | 2 | | 002 | 3 | +-------+--------+
and i want result like this when i select item_id = 001
+-------+---------+-----+-----+-----+-----+-----+-----+-----+ |item_id|item_name|proc1|proc2|proc3|proc4|proc5|proc6|proc7| +-------+---------+-----+-----+-----+-----+-----+-----+-----+ | 001 | Car A | 1 | 2 | 3 | 4 | 5 | | | +-------+---------+-----+-----+-----+-----+-----+-----+-----+
what is the query to produce this result ?