Hi,
I have two tables (structures as below) and I need to update the first one to match a date from the second table. The tables I have are
CONTACT2
accountno | lastdate
CONTSUPP
id | accountno | rectype | lastdate
Now in this for every record within contact2 there can be 0 to unlimited records with a matching accountno.
Now what I need to do is update CONTACT2's 'lastdate' so that it is equal to the newest date from contsupp whereby the rectype is equal to 'R'
I need to run this automatically every night, theres approx 50,000 records in contact2 and about 340,000 in contsupp.
Can anyone help?
UPDATE t1 SET t1.ulastpropa = max(t2.lastdate)
FROM contact2 t1
INNER JOIN contsupp t2 ON t1.accountno = t2.accountno
WHERE t2.rectype='R'
I did try that but failed miserably ....
Many thanks
Mike
I have two tables (structures as below) and I need to update the first one to match a date from the second table. The tables I have are
CONTACT2
accountno | lastdate
CONTSUPP
id | accountno | rectype | lastdate
Now in this for every record within contact2 there can be 0 to unlimited records with a matching accountno.
Now what I need to do is update CONTACT2's 'lastdate' so that it is equal to the newest date from contsupp whereby the rectype is equal to 'R'
I need to run this automatically every night, theres approx 50,000 records in contact2 and about 340,000 in contsupp.
Can anyone help?
UPDATE t1 SET t1.ulastpropa = max(t2.lastdate)
FROM contact2 t1
INNER JOIN contsupp t2 ON t1.accountno = t2.accountno
WHERE t2.rectype='R'
I did try that but failed miserably ....
Many thanks
Mike