I have a oracle query that I need to get the results as columns instead of rows. I wanted this so that I can write another sql to take the columns and compare them. For example if I write the query
select distinct orders from order_master where order_date bettween '01-MAR-2010' and '31-MAR-2010'
The result could be 2 -5 rows depending on the orders, then I want to take those distinct orders and look for products associated to those orders and also want them to be column result since I want to write another query to take the products and find out similarities of their structure
select distinct products from product_master where orders in (select distinct orders from order_master)
the result here again would be
order -1 product -1
order -1 product -2
order -2 product -3
order-3 product -4
order -3 product -1
Then I want to take these distinct orders and products and write another query to see their types to find out if any constant characteristics are found for the products
select distinct types from type_master
where products in (query -2 distinct products)
How can I structure this query to get the constant characteristic types of the product.? I thought getting them as columns will be easier - but any solution that can do all the 3 queries would work for me.