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 02:42:50
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:
00890341
Vues:
16
>Hi Cetin and Dorin
>
>Thanks both of you. Here is the final code from your suggestions
>
>
SELECT tNonCummu.*, sNonCummu.*
>    FROM tNonCummu
>       JOIN sNonCummu ON tNonCummu.iID = sNonCummu.iPID
>    WHERE sNonCummu.dDueDt =
>       (SELECT MAX(sNC.dDueDt)
>          FROM tNonCummu tNC
>             JOIN sNonCummu sNC ON tNC.iID = sNC.iPID
>          GROUP BY sNC.iPID)
>
>We have to group or else only one is shown.

Bhavbuti,
You don't need to group by but be careful this is not the same with the one we suggested.
SELECT tNonCummu.*, sNonCummu.*
    FROM tNonCummu
       JOIN sNonCummu ON tNonCummu.iID = sNonCummu.iPID
    WHERE sNonCummu.dDueDt =
       (SELECT MAX(sNC.dDueDt)
          FROM sNonCummu sNC where sNonCummu.iPID = sNC.iPID )
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