Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
It seems like I got there in the end:
Replace org_id with sub_id. At that point in your Load Script, loading data from subsidiary, the field org_id does not exist.
Left Join ([Organizations])
LOAD
[sub_id] as org_id,
sub_id,
main_id,
if(ISNULL([main_id]), [sub_id]) as NewField
;
SELECT
`sub_id`,
`main_id`
FROM
`db`.subsidiary
;
The issue I have is that the organizations table contains all of the companies, which may be a parent or a subsidiary, but this table does not allow us to link a parent to a subsidiary.
The subsidiary table does the linking, but lists organisations which have parents and subsidiaries (i.e the companies witout a subsidiary are not listed in the subsidiary table.
Therefore if main_id is null, so is the sub_id
What I want to achieve is for the field currently lables as main_id in this table to be populated with the org_id when there is no entry in the subsidiary table. i.e. in the third line does it would contain 39
Thanks
Mark.
It seems like I got there in the end: