On 11/25/20 9:13 AM, Adrian Klaver wrote:
On 11/25/20 8:43 AM, hagen@xxxxxxxxxxxxxx wrote:
Adrian,
Until the previous questions are addressed the above is not doable.
3. Not positive the IF is doing what I want, but if I copy a
sfdc.dealid into the same_test() parameter field the FUNTION does
update the hygiene_119.status field properly. To me, it appears I just
need a way to iterate through and insert one hygiene_119.dealid in
the same_test parameter field. Then the UPDATE should flag all the
hygiene_119 records as SAME or NEW. Obviously I don't REALLY need both
flags as the absence of a flag would indicate status too.
Before continuing with the function I would try some SELECT functions
that do what you want.
Would probably help if I expanded on that. So to find dealids that are
new, something like:
SELECT
new_data.dealid
FROM
hygiene_119 AS new_data
LEFT JOIN
sfdc sp AS old_data
ON
new_data.dealid = old_data.dealid
WHERE
old_data.dealid IS NULL;
The LEFT JOIN will return all the dealids from hygiene_119 and if a
dealid does not exist in sfdc the fields for it will be set to NULL. So
by filtering on old_data.dealid IS NULL you find the dealids that exist
in the new data but not the old.
Best,
Hagen
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx