R: select different column from table A according to table B

R: select different column from table A according to table B

Post by Giancarlo Valent » Tue, 01 May 2001 17:31:18



you can also try this:
select tab_union.value from
(select field1 as value,'field1' as field from tab1
union
select field2 as value,'field2' as field from tab1
union
select field3 as value,'field3' as field from tab1
) tab_union
inner join tabB on tab_union.field = tabB.field
where tabB.comid='pg01'

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?