Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select a record with the most recent date
Message
De
14/02/2022 15:43:38
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
14/02/2022 15:31:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01683566
Message ID:
01683569
Vues:
59
give
SELECT * from MyTransactions
where cast( DateTimeField as date) =  (SELECT TOP 1 cast( DateTimeField as Date) as dDate from MyTransactions ORDER BY dDate DESC)
a try

>SELECT MAX( cast( DateTimeField as Date)) from MyTable
>
>Now...if you want to find all the rows (i.e. transactions) that have that same date as the max date
>
>SELECT * from MyTransactions
>where cast( DateTimeField as date) = (SELECT MAX( cast( DateTimeField as Date)) from MyTransactions)
>
>
>
>>Hi,
>>
>>I am working on creating a SQL Select (against a SQL Server) to find a record with the most recent DATETIME field. But I am only concerned with the DATE portion of this DATETIME field (since the time is irrelevant). Here is a small pseudo example:
>>
>>select Date_Time from MyTable where Date_Time_Is_Most_Recent
>>
>>
>>TIA
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform