BrianTyler
IS-IT--Management
I have several objects which are the components of an address (e.g. ADDR1, ADDR2, ADDR3, POSTCODE). The address table includes a record type: 1=CURRENT 2=TEMPORARY.
I now wish to design objects which will give me fields from the temporary address, but if there is no temporary address to return current address details. I do not really want the user to have to remember to test for the record type as there is a possibility of duplicates if thy forget.
I can do this by including 'where ADDRTYPE = (select max(ADDRTYPE) from CUSTADDR x where x.CUSTNO = CUSTADDR.CUSTNO)' in the object definitions for TEMPORARY address.
When the SQL is generated,the subquery will be repeated in the SQL once for each object, which could destroy performance.
Has anyone any ideas how to stop the repeated generation of the subquery.
(DB2 on AIX + BO 6.5)
Thanks
Brian
I now wish to design objects which will give me fields from the temporary address, but if there is no temporary address to return current address details. I do not really want the user to have to remember to test for the record type as there is a possibility of duplicates if thy forget.
I can do this by including 'where ADDRTYPE = (select max(ADDRTYPE) from CUSTADDR x where x.CUSTNO = CUSTADDR.CUSTNO)' in the object definitions for TEMPORARY address.
When the SQL is generated,the subquery will be repeated in the SQL once for each object, which could destroy performance.
Has anyone any ideas how to stop the repeated generation of the subquery.
(DB2 on AIX + BO 6.5)
Thanks
Brian