you can also try this:
select tab_union.value from
(select field1 as value,'field1' as field from tab1
select field2 as value,'field2' as field from tab1
select field3 as value,'field3' as field from tab1
inner join tabB on tab_union.field = tabB.field
but i don't know if it is the optimal solution ....
how to select different column from table A according to table B
select (select formular from TableB where comid='pg01')
from tableA where markupid=1
the tableA column will be decided by tableB select result. How to do that?