Dynamic table in SQL query using union
Dynamic table in SQL query using union I have below query and it is not working with mag_re as( select a as "A", b as "B" from table1 where 'condition' union all select a as "A", b as "B" from table2 where 'condition' ) select t.a as "A", t.b as "B", M.b as "BB" from table3 t, mag_re M where t.a = M.A union all select t.a as "A", t.b as "B", M.b as "BB" from table4 t, mag_re M where t.a = M.A It is not working, I have the query same as above. I just want to run some query and store into that dynamic table. By using that dynamic table I want to get some data. Original data: with market_reg as ( select acc.account_name, rc1.code_label from customer_node_history cnh,account acc,schedule sc,customer_node_type cnt,reference_Code rc1 where acc.customer_node_id = cnh.customer_node_id and cnh.customer_node_status_code = 3 and account_t...