Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need SQL to find LATEST child record
Message
De
16/04/2003 02:37:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/04/2003 16:07:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00777700
Message ID:
00778193
Vues:
22
>Cetin and Chad,
>I get the error:
>cStatus is not unique and must be qualified in both of your solutions.
>
>Perhaps this is because I am using VFP7.0. I am NOT using SQL server. Would that make a difference?
>Thanks,
>John

John,
Hearing of cStatus for the first time :) Anyway then precede it with alias to resolve ambiguity. ie:
select a.cid, a.cinmate_number, ;
 b.cinmates_id, b.ttxndatetm, b.txnstatus ;
 from INMATES a ;
   inner join ACCT_EVENTS b ;
        on a.cid = b.cinmates_id ;
 where b.txnStatus= 'OPEN' AND ttoc(b.ttxndatetm,1) = ;
   (select max(ttoc(ttxndatetm,1)) from ACCT_EVENTS c ;
     where b.cinmates_id = c.cinmates_id)
PS: Do not undertake ttoc() usage when comparing datetimes. It's purposefully there.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform