November 1, 2017 at 2:44 am
SELECT codart,quantite,datfac
,count(quantite) over (partition by codart order by codart ) as qte
FROM MOUVEMENT where codart is not null
November 1, 2017 at 3:52 am
COUNT doesn't need an ORDER BY in the OVER clause. And as you and I have just learned, not only is it not needed, it's not permitted either.SELECT
codart
, quantite
, datfac
, COUNT(quantite) OVER (PARTITION BY codart) AS qte
FROM MOUVEMENT
WHERE codart IS NOT NULL
John
November 1, 2017 at 6:59 am
That syntax is only allowed starting on SQL Server 2012. You seem to be working on 2008, so that would be a problem.
Try using ROW_NUMBER() instead of COUNT(). In this case, it should give the same result.
EDIT: Si t'as besoin d'aide en Francais, dis-le. Je peux essayer de repondre.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply