I have a table with 3 columns id
, nome
and voto
. They are populated with many records, and I need a calculation that returns the name with the best "balance" of votes . The voto
column can only receive values like 'yes' and 'no', being of string type.
What I need is to check the amount of 'yes' and 'no' for all records and returns those who have a larger balance. If you have a yes, add a dot, if not, remove a dot. I am not able to work with strings.
I'm using SQL Server
In the above case, I need to return the name of Ann because it has a better balance of points
NOTE: ids are unique and names can be repeated