SELECT codart,quantite,datfac
,count(quantite) over (partition by codart order by codart ) as qte
FROM MOUVEMENT where codart is not null
42 ?
,count(quantite) over (partition by codart) as qte
What is the ultimate question?
@bitsmed,
@ghazi
What is the error you're getting? What is the output you want? Post a create table script for [MOUVEMENT] and insert statements with sample data. Since most of us aren't able to read your mind, try to ask your question more clearly.
You can't use ORDER BY with a COUNT or SUM function, because it doesn't make sense there. Also, my guess is you want SUM() rather than COUNT() of quantite, although technically you could just want the COUNT; if so, naturally just change the SUM back to COUNT:
SELECT codart,quantite,datfac
,SUM(quantite) over (partition by codart /* remove the ORDER BY! */) as qte
FROM MOUVEMENT
WHERE codart IS NOT NULL
I presume its as per the Subject, which I assume translates to the English error message "Incorrect syntax near keyword 'ORDER'
"