Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can this be faster
Message
De
30/10/2015 09:19:22
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2014
Application:
Desktop
Divers
Thread ID:
01626554
Message ID:
01626699
Vues:
37
>>>>Actually, further to last I think all it needs is :
SELECT SI.AccountCode,MAX(SI.InvoiceDate) as LastInvoiceDate FROM LV1_Planglow.LV1_DB.SalesInvoiceItem IV 
>>>>INNER JOIN LV1_Planglow.LV1_DB.SalesInvoice SI ON IV.InvoiceNumber = SI.InvoiceNumber
>>>>WHERE ProductCode='56.GTR003.001.01' 
>>>>GROUP BY SI.AccountCode
>>>>HAVING MAX(SI.InvoiceDate) < DATEADD(MONTH, - 1,GETDATE())
>>>
>>>Yes, exactly. But don't forget to add alias to the ProductCode. Even when the column comes from a particular table, as long as you're using more than 1 table in a query give every single column an alias, so maintenance will become easier later.
>>
>>Thx.
>>BTW I tried using TIMESTAMP instead of GETDATE() and it was actually slower ......
>
>How exactly did you measure the performance?

Just looked at the execution time - not very scientific :-{
But I looked at the other thread and I guess it was just coincidence that I was seeing GETDATE() as faster - probably because I ran it after the TIMESTAMP version.....
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform