$sql="select n,count(n) as count_sum from (SELECT group_arrest AS gr,COUNT(DISTINCT crimeref_id) AS n FROM tb_criminal1 WHERE operation_catch = '11' GROUP BY group_arrest)";
Query Error: Error: ER_DERIVED_MUST_HAVE_ALIAS: Every derived table must have its own alias
Code (SQL)
SELECT
SUM(t.n) AS count_sum
FROM
(SELECT
group_arrest AS gr,
COUNT(DISTINCT crimeref_id) AS n
FROM
tb_criminal1
#WHERE
# operation_catch = '11'
GROUP BY
group_arrest
) t