Pendrokar commited on
Commit
7781fb6
·
verified ·
1 Parent(s): ffbd6fc

selected column renamed

Browse files
Files changed (1) hide show
  1. README.md +6 -6
README.md CHANGED
@@ -42,9 +42,9 @@ LIMIT 0, 49999;
42
  ```sql
43
  SELECT
44
  st.spokentext,
45
- (COUNT(DISTINCT vl.chosen) || ' ' || GROUP_CONCAT(DISTINCT vl.chosen)) AS chosen,
46
  vl.rejected,
47
- COUNT(vl.rejected) - COALESCE(chosen_counts.chosen_count, 0) AS times_chosen,
48
  MAX(vl.timestamp) AS lastvote
49
  FROM
50
  votelog vl
@@ -62,15 +62,15 @@ LEFT JOIN (
62
  GROUP BY
63
  st_inner.spokentext,
64
  vl_inner.chosen
65
- ORDER BY
66
- chosen_count DESC
67
  ) AS chosen_counts ON st.spokentext = chosen_counts.spokentext AND vl.rejected = chosen_counts.chosen
68
  GROUP BY
69
  st.spokentext,
70
  vl.rejected
71
- HAVING times_chosen > 0
72
  ORDER BY
73
- ((times_chosen * COUNT(DISTINCT vl.chosen)) / 2) DESC,
74
  COUNT(DISTINCT vl.chosen) DESC,
75
  st.spokentext ASC;
76
 
 
42
  ```sql
43
  SELECT
44
  st.spokentext,
45
+ (COUNT(DISTINCT vl.chosen) || ' ' || GROUP_CONCAT(DISTINCT ' ' || vl.chosen)) AS chosen,
46
  vl.rejected,
47
+ COUNT(vl.rejected) - COALESCE(chosen_counts.chosen_count, 0) AS votes,
48
  MAX(vl.timestamp) AS lastvote
49
  FROM
50
  votelog vl
 
62
  GROUP BY
63
  st_inner.spokentext,
64
  vl_inner.chosen
65
+ ORDER BY
66
+ chosen_count DESC
67
  ) AS chosen_counts ON st.spokentext = chosen_counts.spokentext AND vl.rejected = chosen_counts.chosen
68
  GROUP BY
69
  st.spokentext,
70
  vl.rejected
71
+ HAVING votes > 0
72
  ORDER BY
73
+ ((votes * COUNT(DISTINCT vl.chosen)) / 2) DESC,
74
  COUNT(DISTINCT vl.chosen) DESC,
75
  st.spokentext ASC;
76