I found a solution to my query in this site. I need to get the count(*) value from multiple tables Select count(*) from multiple tables
My other problem is to get the DATE values of those multiple tables that returns > 1 row count. I have to compare the dates and get the latest. I have to query from 12 tables. Assuming I got > 1 value for tables 1, 2, 3, 4, 5, I will need to compare their DATE values. Sample code:
SELECT(SELECT COUNT(*) FROM table1) AS count1,
(SELECT COUNT(*) FROM table2) AS count2,
(SELECT COUNT(*) FROM table3) AS count3 FROM dual
count1 count2 count3
3 2 2
I need to select the MOST RECENT date in these tables.
Select date from table1 order by date desc
Select date from table2 order by date desc
Select date from table3 order by date desc
How am I supposed to do that without table scanning?
EDIT: Okay. The instructions said "Get matching records from tables 1-12 using the id as the key". If there are no records, display "No record found" Else: get the record with the latest date by comparing data_encoded from all tables.