In certain scenario's we want to restrict a 1:n relation into a 1:1 relation. For instance when only information from the first record is of any interest (like an earliest date)
I am used to adding such a restriction to a join like:
However, I cannot get the syntax right when I modify an existing join.
I can create an additional query-subject that stores all min(dates) for each key and then add a join over both key and date from the new query subject to the table2.
That should have the same effect (if an object from this query subject is added to the selection)
What am I missing. Is it at all possible to modify a straight join this way?
Ties Blom
I am used to adding such a restriction to a join like:
Code:
table1.field1 = table2.field1 and [COLOR=red]
table2.date = (select min(t2_alias.date) from table2 t2_alias
where table2.key = t2_alias.key) [/color]
However, I cannot get the syntax right when I modify an existing join.
I can create an additional query-subject that stores all min(dates) for each key and then add a join over both key and date from the new query subject to the table2.
That should have the same effect (if an object from this query subject is added to the selection)
What am I missing. Is it at all possible to modify a straight join this way?
Ties Blom