Derive a column based on the columns from history tables

Database
Enthusiast

Derive a column based on the columns from history tables

I have a Table Main_table with ID field and few other columns, I have 8 history tables with ID and few other fields in each of the tables. I have to take the ID from Main_Table and check for the ID = 1 in each of the history tables  if in any of thehistory  tables ID = 1 then add a column 'Indicator' to Main_table as 'Yes'. Next check for ID <> 1 in history tables if present in any of the 8 tables then mark as ' No' else 'Not Applicable'. Each of the history table as huge number of rows, so how do I check?

1 REPLY 1
Ambassador

Re: Derive a column based on the columns from history tables

I don't get your exact requirements:

Next check for ID <> 1 in history tables if present in any of the 8 tables then mark as ' No' else 'Not Applicable'.

 

Can you show some example data and more detailed explanation?