Calculating a field in a load using data from another table
I am trying to calculate an age based on two tables, one has the birthdate along with a bunch of data related to the birth and the other contains information on measurements taken on various dates. This looks like it should be so simple but I just can't work it out. I think it must be something to do with a resident load but I just can't work out the practical syntax.
The load statement I have looks like this:
Birth:
LOADBirthGUID, Region, Sex, Date(Date#(Date,'YYYY-MM-DD hh:mm:ss'),'M/D/YYYY')asBirth_Date, WeightgasBirth_Weight FROM [C:\Users\ etc.
Weighing: LOAD BirthGUID, Date(Date#(Date,'YYYY-MM-DD hh:mm:ss'),'M/D/YYYY') asWeighing_Date, WeightgasSample_Weight FROM [C:\Users\etc.
I want to be able to calculate the age at weighing as Weighing_Date minus Birth_Date
LOAD BirthGUID, Region, Sex, Date(Date#(Date,'YYYY-MM-DD hh:mm:ss'),'M/D/YYYY')as Birth_Date, Weightg as Birth_Weight FROM , Weightg as Sample_Weight FROM [C:\Users\etc.