Linking two tables together

Hello,

I have been given two tables one a parent table and the other a child table. The parent table contains a foreign key of the child table. I need to gain access to another field in the child using the foreign key in the parent.

I have created a new virtual column to do this and I have used a LookUp expression to match the data, but nothing shows up when I test the results.

Is there any other way of doing this?

0 9 599
9 REPLIES 9

Are you using a related table structure? I mean do you have a Ref field in your child table?

Hello, Yes I have a ref field in the child table

These are the tables

Child

Parent

and this is the look up from Guage name
LOOKUP(Gauge_ID, dbo.DATA_Gauge, P_ID, Gauge)

You are probably looking for syntax likeโ€ฆ LOOKUP([_THISROW].[Gauge_ID], dbo.DATA_Gauge, P_ID, Gauge)

If you want to read value from a Parent table, you can use a Deref expression like [RefColumnName].[ColumnNameInParentTable]

Are you adding that to the end of the statement above?

Iโ€™m trying to reference the value from the child not the parent. So I am matching the Guage ID with the ID in the guage table and then I am looking within that Data_Gauge table to find the name of that Guage

When you want to read the value from the child table please remember that there can be more than just one child record and then the result can be โ€œwrongโ€. Is that the situation?

Top Labels in this Space