Grigore Dolghin wrote:
> It seems I am missing something obvious, however I can't figure out what.
>
> I have two tables, 1-to-many related. Parent table contains car information,
> child table contains the registration numbers, with their date, as they
> change.
>
> Parent table fields:
>
> Id, Serial, Model
>
> Child table fields:
>
> Id, CarId, RegNumber, RegDate
>
>
> How the heck the SQL that returns a list of the cars with their most recent
> registration number looks like? I just can't figure it.
>
Something like :
select *
from Parent
left join Child
on Parent.Id = Child.Id
where Child.RegDate >= (
select Oldest.RegDate
from Child Oldest
where Oldest.Id = Child.Id
)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.