Columns: maket id, market name
Columns: Region id, Region Name, market id1, market id2, market id3, market id4...... N no. of markets.
Now, i would like to have SQL statement that should give me the row as below
Region Name, Market1 Name, Market2 Name, Market3 Name, Market4 name...
Welcome to the forums.
You wrote "Please suggest" so I will.
I suggest you read the FAQ and learn how to post to this forum. The information you have provided, and the lack of formatting, mean your inquiry likely won't be answered. After reading the FAQ please fix what you posted providing all relevant information. Thank you.
You can use one of the following methods:
*1.* select name region,
(select name from market where id=id1) market1,
(select name from market where id=id2) market2,
*2.* select r.name region,
from region r, market m1, market m2, ... where m1.id(+)=id1 and m2.id(+)=id2 and ...;
*3.* select name region,
cursor(select name from market where id=m_id1 or id=m_id2 or ...) market from region;