selected column renamed
Browse files
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
|
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 |
-
|
66 |
-
|
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
|
72 |
ORDER BY
|
73 |
-
((
|
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 |
|