Desired Output in Fact Table:
After loading the Fact table, I would like to delete records that have certain OrderStatus that are in 'DeleteOrderStatus' table. Using KEEP/INNER JOIN, I was able to include certain records. Is there a way I can exclude certain records based on another table?
Thanks in advance.
Exists() is the way to go!
Additionally, if you want to keep your load optimized (if qvd is your source), dont't rename OrderStatus field and use:
where not Exists(OrderStatus). It is faster.
It worked. Thank you Stefan and Raviteja.
Is there any reason why the field name in the filter was changed? The reason I am asking is when I tried to use the same field name twice as below, the filter did not work properly. Could you please explain why the below ocde does not work?
LOAD * FROM FactTable
WHERE NOT EXISTS(OrderStatus, OrderStatus);
Hi Vamshi , NOT EXISTS(OrderStatus, OrderStatus); Compares values of Field(1st in arguments) from Current table from the already available field (2nd in the arguments)in the memory..
you could try just where not exists(OrderStatus) if incase you want to use only same field.
Please mark Helpful or Answered so that it helps for the community.
WHERE NOT EXISTS(OrderStatus);
instead of the two argument version, you won't get all requested records if OrderStatus is not a primary key (which I assume it is not).
In other words, as soon as your LOAD encountered the first record with OrderStatus FIRM, FIRM is part of the symbols that the exists() function checks the upcoming record values against. Hence, no other records with OrderStatus FIRM will pass the WHERE clause and will be loaded to the resident output table.
I guess that's what you see when you are mentioning that this approach 'will not work properly', right?