# Counting rows

**URL:** <https://forum.kirupa.com/t/counting-rows/225296>\
**Category:** programming\
**Created:** [May 10, 2007, 2:16pm UTC](https://forum.kirupa.com/t/counting-rows/225296 "2007-05-10T14:16:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunetics](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lunetics](https://forum.kirupa.com/u/lunetics)\
**Post date:** [May 10, 2007, 2:16pm UTC](https://forum.kirupa.com/t/counting-rows/225296/1 "2007-05-10T14:16:34Z")

</div>

I´ve a little counting-row-problem. This how the SQL Query looks like:

```auto

SELECT dog_id, SUM(points) AS sum
FROM Protocol AS Protocoll_1
WHERE (prot_status = 2)
GROUP BY dog_id
ORDER BY sum DESC

```

Now I just want to add an column with the row number. How to do that?
