how to calculate / SUM of column by the latest data of updateid column ?
I try this :
SELECT * FROM yourTable;
SELECT
ANY_VALUE(code) AS code,
COUNT(*) AS total_rows,
SUM(data->'$.chart."21"') AS total_a
FROM yourTable
GROUP BY code
ORDER BY code;
From above query it sums all rows, it should be sum the latest update id
anyone can solve this problem ?
here is the fiddle : https://www.db-fiddle.com/f/qHnaHNQtEhDasLiSB4Jhv5/0
Best Answer