I have to implement below mentioned design using SQL queries(DB2 Database).Pls help with your suggestions.
The base table 'BA' has an attribute (say X), which has two values - 'active' and 'inactive'. table BA is to be joined with table BA_ALT(which is identical to BA, but it stores 1 days history data). And the data is to be loaded in the target table 'tgt'. And the condtion to be implementated is - if the value of X is 'active', then the row must be loaded directlt in the tgt, but if the x='inactive', then some transformation logic is to be implementated and the row is to be loaded.
Now my query is , can this be implemented with 2 insert statements, in one using where x='active' in the join condition and in second insert , using where x='inactive'? will this work? Or is there a better way of implementin this if else situation?
PS-- the OS is unix. The queries will be executed in a unix scrpit.