# CLI COMMANDS IN PHPMYADMIN TO CHECK RESULTS
SELECT token, vote, datum, hash FROM voting_ballot ORDER BY token, datum;

CREATE TEMPORARY TABLE IF NOT EXISTS votingresult AS
(SELECT token, vote, MAX(datum) AS datum , COUNT(vote) AS 'count', hash FROM voting_ballot GROUP BY token DESC ORDER BY vote);

SELECT * FROM votingresult;

SELECT vote, COUNT(vote) AS 'count' FROM votingresult GROUP BY vote ORDER BY 'count' DESC, vote;

SELECT
( SELECT COUNT(*)    FROM voting_members ) AS members,
( SELECT COUNT(*)    FROM voting_tokens  ) AS tokens,
( SELECT COUNT(*)    FROM voting_ballot  ) AS totalvoted,
( SELECT COUNT(vote) FROM votingresult   ) AS ballot;

VOTING HISTORY

token vote datum hash

CREATE TEMPORARY TABLE TO COUNT UNIQUE VOTES WITH HISTORY COUNT

Temporary table results are not displayed

SHOW THE DETAILED FINAL RESULT OF THE TEMPORARY RESULT

The count number is the number of times a voter voted and/or changed his mind.
Unless the voter cleared his voting history.
Only the last vote is counted towards the final result.
Compare with the voting history above.

token vote datum count hash

AS BEFORE, JUST THE WINNERS + COUNT

vote count

SUMMARY COUNT OF MEMBERS, TOKENS AND BALLOT

Note that the ballot count should be less or equal to the members count.
More ballot counts mean more tokens are used than members.
Unless there is a list of member <==> tokens, there is NO WAY to know who was a real/fake voter.
Solution : create fewer or equal numbers of tokens as there are members.

members tokens totalvoted ballot
10010000