Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trouble with ORDER BY
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00776296
Message ID:
00776335
Vues:
14
>You should be able to add GROUP BY and ORDER BY DayField into you SELECT statement.
>
>Stephen
>
It doesn't allow me to use DayField, but it does work if I use:
ORDER BY (cast(datepart(mm,time) as varchar)+'/'+datename(dd,time)+'/'+datename(yyyy,time))

After the GROUP BY

I thought I tried this before. I must have dropped a paren.

Thanks!

>
>>>SELECT (cast(datepart(mm,time) as varchar)+'/'+datename(dd,time)+'/'+datename(yyyy,time)) AS DayField,
>>>COUNT(CondoDir) AS Hits FROM wwRequestLog
>>>WHERE UPPER(CondoDir) LIKE 'FRANKLIN'
>>>AND DATEDIFF(day, time, getdate()) < 14
>>>GROUP BY (cast(datepart(mm,time) as varchar)+'/'+datename(dd,time)+'/'+datename(yyyy,time))
>>>
>>>
>>>TIA
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform