Improving a query for displaying elections