Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Latest Date Record
Message
De
21/05/2017 07:11:11
 
 
À
20/05/2017 08:41:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01651259
Message ID:
01651276
Vues:
60
>I have a vfp 6.0 table that contain date senstive entries:
>
>Table name: SearchTrack.dbf
>search_name
>search_desc
>search_date
>
>The max searches a user can have is (4), so when the user tries to search a 5th time, i want to grab the record with the latest search date and simply replace the search name, desc fields as well as update the search_date field with the new system date.

I assume you mean you want to earliest, not the latest, but if you really mean latest, flip the sign here.
UPDATE SearchTrack ;
   SET Search_Name = m.NewName, ;
           Search_Desc = m.NewDesc, ;
           Search_Date= DATETIME() ;
   WHERE Search_Date = (SELECT MIN(search_date) FROM SearchTrack)
I've assumed that Search_Date is actually a DateTime, so that it can be used to actually uniquely choose the oldest. If it's just a date, you have to deal with the possibility of having two records with the same value. (Technically, that's true for datetime as well, but that seems unlikely in your use case.)

Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform