Reputation: 743
My aim is to count according to the id
once time same id It doesn't count every id
each time.
I used this:
Select count Where id=1 between 1000;
but it counts to smilar id
more than one.
Upvotes: 0
Views: 68
Reputation: 831
Have you try this :
Count with ID
like this
SELECT COUNT(ID) FROM dbo.TableName WHERE ID BETWEEN 1 AND 1000
Upvotes: 0
Reputation: 780889
Use DISTINCT
SELECT COUNT(DISTINCT id)
FROM YourTable
WHERE id BETWEEN 1 AND 1000
Upvotes: 2