Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to check if the value of a field (CustomerID) in a table A is in any record of other table B, in the field PartnerID.
I am processing every record in table A. If the value of the CustomerID field can be found in table B, I'll update a field in table A.
I have tried with exists:
if(exists(CustomerID, PartnerID), "Yes","No") as CustomerIsPartner,
but QV cannot find PartnerID.
Should I go this way or can this be achieved with any other command?
Many thanks in advance.
I believe all you need to do is swap the field order and use single quotes:
if(exists(PartnerID, CustomerID),'Yes','No') as CustomerIsPartner
Hello,
You may use
LOAD PartnerID FROM FILE.QVD (qvd) WHERE EXISTS(CustomerID, PartnerID);
So the final table loaded will only contain those records where PartnerID matches with an already existing CustomerID.
Hope this helps!
I believe all you need to do is swap the field order and use single quotes:
if(exists(PartnerID, CustomerID),'Yes','No') as CustomerIsPartner
Thank you, I'll have a look at the usage of .qvd files.
Hello,
you were right, the order of the fields was incorrect. It works perfectly now!