Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to retrieve latest production date for each repair o
Message
 
 
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 9 SP1
Divers
Thread ID:
01228970
Message ID:
01229008
Vues:
17
>Looking at this part
>
>
>lu_key IN ;
> (SELECT CTOBIN(RIGHT(MAX(DTOS(item_date )+BINTOC(lu_key )),4)) ;
>
>I'm trying to figure out in which order the processing takes place so I can understand the logic behind it. The 2 fields are concatenated, then you find the max aggregate, retrieve the last 4 char and convert to binary which will compare to the "lu_key IN" statement.
>
>Is that correct? My main question is: How can you do a comparison on 2 separate fields that are combined? I never knew you could do that.
>
>Thanks,
>
>Marcel

After all the conversions you get back the ID field for the max date. You also get the max ID if you have 2 same dates in your table, so you always retrieve just one record per max date. In the second link I provided there was another SQL, which would retrieve all records with the same max date. So, you may choose which SQL suits your needs best.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform