I have A
table, B
table 10 different tables(1
,2
,3
,..10
). I have to select the data by joining any one/more of those 10 , A
, and B
tables based on the input.
Ex: If input is only 2,5,8,10 I have to join A
, B
, 2
,5
,8
, and 10
tables and retrieve the data. If input is only 1 and 7
th table , I have to join A
, B
, 1
, and 7
tables and retrieve the data.
---- sample-----
suppose A is a person table with p_id, p_name, order_id,.......
B is an order table with Order_id,.........
each 1-10 tables are shopping items like clothes, shoes, electronics,...etc
now I want to pull person details who orders only clothes and shoes with some other constraints like within these dates or age should be 20 like that then I have to join only person table, order table, clothes table, and shoe table and retrived the details about the persons who ordered atlease one of both the tables. person having only shoe or only colthes are not required. result will be like how many clothes he orderd and how many shoes he ordered.
Can anyone please give me some idea how to do it. I am working on oracle db and using SQL.