Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select a record with the most recent date
Message
From
17/02/2022 08:07:55
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01683566
Message ID:
01683591
Views:
46
Hi Dmitry,
my guess is that you are using an old ODBC driver that does not know the Date type.

>Just a follow-up question.
>Why does the field DATE (in the SQL Select you suggested) is a Char type? Nothing wrong. I would just like to understand why when you CAST the DateTime to DATE, the result is a char type and not a Date type.
>
>>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
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform