Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group By Having Problems
Message
De
22/03/2005 12:11:02
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00998084
Message ID:
00998166
Vues:
12
>>>BTW, here's the simplest way to get datime value w/o time portion
GROUP BY DATEADD(day, DATEDIFF(day, 0, ft.trans_date), 0)
>>
>>Thank reduced the time to run the Select from about 10-15 minutes to about
>>10-15 seconds.
>
>Interesting. Did you also replace ShipDate calculation in the column list with this exprerssion?


SELECT
DATEADD(day, DATEDIFF(day, 0, ft.trans_date), 0) AS Ship_date
,COUNT(*) AS Orders
FROM
dbo.vw_53_ordersCount oc
INNER JOIN
dbo.Fulfillment_Transaction ft
ON oc.orders_id = ft.trans_key01
AND ft.trans_module = 'ORDERS'
AND ft.trans_submodule = 'SHIPPED'

Where ft.trans_date between '2005-2-19 00:00' and '2005-3-18 00:00'

GROUP BY DATEADD(day, DATEDIFF(day, 0, ft.trans_date), 0)


Order by ship_Date

2005-02-19 00:00:00.000 630
2005-02-21 00:00:00.000 175
2005-02-22 00:00:00.000 574
2005-02-23 00:00:00.000 1401
2005-02-24 00:00:00.000 1114
2005-02-25 00:00:00.000 685
2005-02-28 00:00:00.000 1481
2005-03-01 00:00:00.000 1290
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform