Click here to Skip to main content
15,614,270 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can i use over clause after from table on sql server 2012 ?
I have technical question
can i use over clause over count after make select from table
to make count rows

What I have tried:

select partid,product
from product
count(partid) over
Updated 15-Mar-21 22:52pm

Share this answer
Maciej Los 16-Mar-21 4:15am    
You have already asked 289 questions, most of them about SQL!

I'd suggest you to buy good book about SQL. Read it, read it again and read it every time before you ask a question. MSDN documentation is obligatory reading too!

Do you know what people think about such of lazy programmer?

As to your qustion... Have you tried to execute your query?
Please, do not answer. I know the answer: No, you don't! Because you'll know that this statement is wrong!

To get count of records:
select partid, product, COUNT(*) OVER(ORDER BY partid) CountOfRecordsInProductTable
from product;

More detalis at: COUNT (Transact-SQL) - SQL Server | Microsoft Docs[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900