Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select SQL - Selecting one of Multiple Entries
Message
De
12/10/1998 01:56:29
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
11/10/1998 07:58:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00144791
Message ID:
00145832
Vues:
43
>Cetin,
>
>Yes I tested the code (and thank you for the time you put into it) but I kept getting a 'function error' on running it. What I've done since then is dropped the parent relationship and for the moment am just trying to retrieve, from one table, the latest (in date order) referral record for any MNO as per the example. Once I have that sorted we can go back to working on the parent/child model
>
>Hope you are well - do you actually live in Turkey by the way?

Hi Bob,
First SQL on child consists of selecting most recent dates :
select mno, max(refdate) from referrals ;
 into cursor myCursor ;
 group by mno

* For a subquery could be also
select mno+dtos(max(refdate)) from referrals ;
 into cursor myCursor ;
 group by mno

* For final selection
select * from main ;
  left join referrals  ;
  on main.mno = referrals.mno ;
  where referrals.mno + dtos(referrals.refdate) in ;
      ( select mno+dtos(max(refdate)) from referrals ;
              group by mno ) ;
  into cursor myCursor
Hope this does it.

Yes, I do live in Turkey and never been abroad :) BTW why?
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