>>I'm trying to select out from a parent table to a child table. The child can have multiple entries but I want to return the line with the largest value. I've tried a couple of select combinations but I'm not getting the correct result
>>
>>PARENT
>>1 Name1
>>2 Name2
>>3 Name3
>>
>>CHILD
>>1 12 Code1
>>2 19 Code2
>>2 16 Code3
>>3 10 Code4
>>3 13 Code5
>>
>>I want the result to be
>>Name1 Code1
>>Name2 Code2
>>Name3 Code5
>>
>>~M
>
>
>SELECT Parent.Name,;
> Child.Code;
>FROM Parent;
>INNER JOIN (SELECT Child.ParentFld, Child.Code;
> FROM Child;
> INNER JOIN (SELECT ParentFld, MAX(IdFld) AS IdFld;
> FROM Child;
> GROUP BY ParentFld) Chld;
> ON Child.ParentFld = Chld.ParentFld AND Child.IdFld = Chld.IdFld) Child;
> ON Child.ParentFld = Parent.IdFld
>
Thanks I'll give it a go. Had something similar but got a warning on too many levels or similar.
~M
Go raibh maith agat
~M