I have a total of 3 tables. One table is called
CNTCT_ID as a primary index.
Second table is
CONTACTMAP which links a customer(
CUSTNUM) to all the contactinfo (details suchs as name, position, phone number etc).
Final table is a complete customer list, with one column that has a revolving list of all our customers.
My code below pulls back the most recent entry for
custnum 84574. But I need it pull back results for all
custnum in the complete customer list
from CONTACTINFO a
JOIN CONTACTMAP B
ON A.CNTCT_ID = B.CNTCT_ID
where b. CUSTNUM in (‘84574’)
and A. CUST_TYPE in (‘PAYER’)
qualify rank() over (partition by a. CUST_TYPE order by A. CINSERT_DT desc) = 1
Here are my tables