Hi All,
I have few table in my DB named info_1,info_2,info_3,info_4 and there is lookuptable named main_info.
Main_info table contains
ID Startdate EndDate
1 12/16/2013-00:00 12/16/2013-11:59
2 12/17/2013-00:00 12/17/2013-11:59
3 12/18/2013-00:00 12/18/2013-11:59
4 12/19/2013-00:00 12/19/2013-11:59
Info_1 table contains
ID Date Name Address Phone Number
1 -00:00 a b 1111
1 12/16/2013-02:00 ab b b 2222
Info_2 contains
ID Date Name Address Phone Number
2 12/16/2013-00:00 aaa bbbbb 1111
2 12/16/2013-02:00 abcccc bbvvvv 2222
Similarly Info_3 as well which has ID=3
We have multiple such info_X tables and each table contains 1000 records with unique ID.
Issue is if you want to query for data between 12/16/2013-00:00 to 12/18/2013-11:00, you need to query:
• info_1 (from 12/16/2013-00:00 to its end);
• info_2 (from 12/17/2013-00:00 to its end);
• info_3 (from 12/18/2013-00:00 to 12/18/2013-11:00 );
>Question is how to achieve this. How can I union multiple tables dynamically as mentioned above.
Any inputs would be greats.
Regards,
Raj