Skip to content
Advertisement

SQL Getting the party with highest votes

I am trying to make a voting system through a SQL server, and I can’t get it right. What I am trying to do is get the party with the highest amount of votes.

I expect something like [DEMS][8], or at the very least, the party name of the party with the highest votes.

enter image description here

Advertisement

Answer

Rather than using a WHERE clause you need to use whatever the syntax is for the top record in your SQL dialect. You also need to group by partijnaam. This is a bit of a guess as I don;t know your exact data structure.

Postgres/MySQL

SQL Server

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement