I have a datbase that look like this:
vnr|cnr|enr| ip|dato
---+---+---+---------------+----------------------
1| 1| 17|195.192.136.223|1998-10-14 02:30:18+02
2| 1| 1|195.192.136.164|1998-10-14 02:33:03+02
5| 1| 13|195.192.136.173|1998-10-14 02:49:24+02
8| 1| 15|195.192.136.207|1998-10-14 02:49:27+02
9| 1| 16|195.192.136.211|1998-10-14 02:49:31+02
10| 1| 11|195.192.136.123|1998-10-14 02:49:44+02
11| 1| 15|195.192.136.162|1998-10-14 02:49:48+02
7| 1| 13|195.192.136.126|1998-10-14 02:49:50+02
Where vnr, cnr, enr are int fields, and ip, date are text. The database
is used for a votingsystem. vnr is the vote number, cnr is the
contestnumber and enr is the entrynumber.
When i do a :
./psql -c "select count(vnr),enr from votes where cnr=1 group by enr"
vote
to get the result from contest number 1 i get :
count|enr
-----+---
11| 1
1| 2
1| 3
4| 4
1| 5
1| 6
10| 8
....
This is almost what i want, execpt that i want the result to be ordered
by count, instead og enr. so that the entry, which got most votes is listed first
For example:
11| 1
10| 8
4| 4
1| 2
1| 3
1| 5
1| 6
hope someone outthere can help me :)
Henrik Pedersen
Demark