Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can this be faster
Message
 
 
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:
01626560
Vues:
47
>Try
>
>SELECT SI.AccountCode, MAX(SI.InvoiceDate) AS Latest  
>	FROM SalesInvoiceItem IV 
>		INNER JOIN SalesInvoice SI ON IV.InvoiceNumber = SI.InvoiceNumber
>	WHERE ProductCode='56.GTR003.001.01' AND MAX(SI.InvoiceDate) < DATEADD(MONTH, - 1,GETDATE())
>GROUP BY SI.AccountCode
>
You can not use MAX() function in the WHERE clause, only in the HAVING clause.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform