Average By Rows With Sqlite
I'm working with a sqlite database. The tables are: ID_TABLE POINTS_A_TABLE POINTS_B_TABLE id number id_a points_a id_a points_a --------------
Solution 1:
If you smush together all point tables, you can then simply compute the average for each group:
SELECT id,
avg(points_a)
FROM (SELECT id_a AS id, points_a FROM points_a_table
UNION ALL
SELECT id_a AS id, points_a FROM points_b_table
UNION ALL
SELECT id_a AS id, points_a FROM points_c_table
UNION ALL
SELECT id_a AS id, points_a FROM points_d_table)
GROUP BY id
ORDER BY avg(points_a) DESC;
Post a Comment for "Average By Rows With Sqlite"