I have 3 tables here with the columns as below:
ADDR - cifkey(PK), addr1,addr2,addr3,addr4,addr5,postcd
CIF- cifkey(PK), cust_id(PK)
TEMP - cust_id(PK)
I have a program to insert record at TEMP table which having cust_id as primary key. With the cust_id, I would like to retrieve address and postcode from table ADDR and return back to the program. The selection should based on the cifkey and cust_id among these 3 tables.
I have come out a basic SQL as below and would like to seek for advice..
select a.addr1,a.addr2,a.addr3,a.addr4,a.addr5,a.postcd from ADDR a, CIF b, TEMP c where a.cifkey=b.cifkey and b.cust_id= c.cust_id