Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select field based on max(other field) ?
Message
De
21/04/2005 11:29:35
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Divers
Thread ID:
01006645
Message ID:
01007059
Vues:
19
>>How can I build a single record parent-child view with all the child values coming from the same record? The child record should supply date, amount and otherfield values, but all of them from the record with max(date). Using max(amount) and max(otherfield) gives values that aren't what I need. For this example, I need 6/1/2004, $90.00, Abacus.
>>
>>Date        Amount   Otherfield
>>01/10/2004  $115.00  Zephyr
>>06/01/2004  $90.00   Abacus
>>
>IF there is only going to be one record for a date and IF there are less than 5 fileds then I would do
>select max(dtoc(date))+str(amount)+otherfield
>and then parse out the results.
>
>Yes, this could be done in one select statement but I prefer to split things up like this. IMHO, makes it easier later on when it comes to debugging , commenting and the such.

It's a view, so I can't really split it. This is an ugly solution, but it works. I can't help but think there has to be an easier one.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform