sql query--need help
Hi fellow developers, 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.
Originally Posted by indigo3 will this work? Yes. Originally Posted by indigo3 is there a better way of implementin this if else situation? You might try using the CASE expression.
SQL1822N Unexpected error code "-30082
doubt high availability data replication
Help on logical partition setup (db2 9.7 ese)
Detect from catalog if Varchar-Column was defined for Bit/Mixed/SBCSData
problem with this function?
reorg DB2 Z/OS job
oracle vs db2
DB2 Dynamic query execution which returns row count
DB2 hadr on standby hangs after disconnect from primary
How to archive smartly in db2 ?
Strange SELECT query behaviour
Cataloging Mainframe table
configuration tool error
Transformation of date format
Date and Time Dimensions