Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by date portion of datetime
Message
De
03/05/1997 11:37:37
 
 
À
01/05/1997 00:15:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00029545
Message ID:
00030744
Vues:
37
>>>>>>Does anyone know how to group a result set on just the date portion of a datetime column using SQL pass-through?
>>>>>
>>>>>Just select one more column: datepart as date(datetime field) and group on this column.
>>>>>
>>>>>Vlad
>>>>
>>>>The DatePart function in MS SQL server doesn't allow you to return the entire date portion. I would have to concatenate the year, month and day portions and I'm hoping to avoid that.
>>>
>>>I don't know MSSQL. Are you using VFP? How do you access the SQL database? Via ODBC?
>>>
>>>If yes, you should be able to use date( your_datetime_field) which should return the date part of datetime field.
>>>
>>>Vlad
>>
>>With SQL passthrough, the date function will only work if it is supported by the backend server.
>
>
>Just wondering if you found a solution to this without having to
>concatenate the year, month, and day?

I settled on the convert function: Convert(Char(8),DateField,1) works for the Group By clause. For the Select clause I use Max(DateField) because I want to return a date.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform