Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
V6s5 - SQL for Parent and only the Latest Child rec
Message
De
29/03/2004 10:53:39
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00888750
Message ID:
00890434
Vues:
29
>Hi Cetin
>
>>In pseudocode it's like :
>>
>>Select distinct values
>>while selecting
>>select the record with the latest date and populate related fields from that record
>>
>>>> WHERE sNonCummu.dDueDt =
>>>> (SELECT MAX(sNC.dDueDt)
>>>> FROM sNonCummu sNC where sNonCummu.iPID = sNC.iPID )
>>
>>Tells to find latest date for 'current of' iPID.
>>= works as subquery returns a single value.
>
>Yes, but I wanted one latest for every parent, thus so. W/o group by it doesn't work it returns only one child which is the latest of the whole lot of children.

And it's one latest per parent. If not working that way then your backend has a problem with ANSI-SQL 92.
In SQL try aliasing the first sNonCummu with something else like sNC1.
Anyway if you have a working one :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform