Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have the following problem:
I have one table 'Sales' with a key field SalesId and a nother table left joining Sales called SalesResult with a field SalesResultId. However I would like to create an generic key out of SalesId&'|'&SalesResultId to create an unique identifier for all Sales.
Can someone give me an easy example how to do this?
Best
Harry
Hi,
Please provide sample file this will more easy.
Ex:- For composite keys try this ways and let me know.
tmpTable:
Load
SalesId
From Sales;
Left Join(tmpTable)
Load
SalesResultId
From SalesResult;
Load
SalesId,
SalesResultId,
SalesId&'|'&SalesResultId as %Key
Resident tmpTable;
Drop Table tmpTable;
Regards
Anand
Just make a composite key
Load
SalesId&'|'&SalesResultId as Comp_Key,
Xyz,
from abc;
Thanks, Saumya! But this is not working for me because you have table SalesResult is joining table Sales. Therefore SalesResultId is unknown in Sales. I tried the following but got a synthetic key:
LEFT JOIN (Sales)
LOAD
SalesId&'|'&SalesResultId as Comp_Key
RESIDENT Sales;
Can you please send me your script.
I will edit and let you know the correct path.
Hi,
Please provide sample file this will more easy.
Ex:- For composite keys try this ways and let me know.
tmpTable:
Load
SalesId
From Sales;
Left Join(tmpTable)
Load
SalesResultId
From SalesResult;
Load
SalesId,
SalesResultId,
SalesId&'|'&SalesResultId as %Key
Resident tmpTable;
Drop Table tmpTable;
Regards
Anand
Hi Harry,
I hope two columns SalesId,SalesResultId available in two tables. so at this point synthetic keys will generate.
If you are trying to avoid synthetic key, Please follow this
Sales -- keep it in two fields and generate a new column with concatenate
SalesResult -- common two fileds are commented and generate a new column with concatenate, its associated with previous one.
But two column names are same. then only associated.
Regards,
Sub2u.