I have the following data which are in different tables
Address.db Name and Birthday of Husband
Wife.db Name and Birthday of Wifw
Child1.Db Name and Birthday of First child
Child2.Db Name and Birthday of Second child
(due to table design the data have to be in different tables and not just in one table)
There are other tables and other data which are not relevant for the present problem.
What i wanted to do was based on some criteria like 'display name and birthday for birthdays occuring
during the next one week' i want all the
records satisfying the criteria to be stored and displayed in one dbgrid with two fields
name and birthday.
I have done it in the following manner
Check the criteria against each of the table data(address,wife,child1,child2 etc).If any record
satisfies the criteria, a new record is inserted into the Birthdays.db(name and Birthdate fields) till
all the tables are checked.Finally the data is displayed in the dbgrid.
When the next criteria is required emptyTable is done for Birthdays.db and the whole process is done again.
Even though the above works fine ,can SQL do a better job? ie by just firing one query
all the work gets done of transfering the criteia matching data from different tables into one table only