Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with SQL Syntax
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00630077
Message ID:
00630106
Vues:
24
Duh! You're right. I'm used to using it in subqueries. Back to sleep for me!!

>In VFP TOP clause requires Order BY that determines what columns are taken in account by Top clause. It wouldn't help in this case because it'll return 1 records per query not per group.
>
>>Try Select Top 1 Referral.* instead of your Select Referral.*. This *should* return the earliest (I'm not 100% on whether Top 1 is selected before or after the Order clause).
>>
>>>Hi
>>>
>>>I need confirmation on this, can anyone advise?
>>>
>>>There may be cases in the Referral Table where there may be 2> entries for the same Date (Re_Date) for a Client (Cl_Ref). I want this select to pick up the earliest time'd (Re_Time) Referral if there is more than 1 record for the same Date.
>>>
>>>Hope the above is clear!! Here is my code
>>>
>>>
*Obtain contacts
>>>SELECT Referral.*;
>>>  FROM Referral;
>>> INNER JOIN Client;
>>>    ON Referral.Cl_Ref = Client.Cl_Ref;
>>> WHERE BETWEEN(DTOS(Re_Date), DTOS(gdStartDate), DTOS(gdEndDate));
>>>   AND Re_Message = "R";
>>>   AND Re_Error <> "Y";
>>>   AND Re_Nfa <> "Y";
>>> ORDER BY Re_Time;
>>> GROUP BY Referral.Cl_Ref, Re_Date
>>>
>>>
>>>
>>>Will the above Select do this for me?
>>>
>>>Thanks
>>>Kev
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform