I have a table named financial_trans
which consist of
id (AI,INT)
amount (DOUBLE)
acadYear (VARCHAR) // probably '2020-2021'
now I want to count the similar acadYear using group by and store it into a mysql variable and my query for that is
SELECT s.total as total
INTO @year
FROM (
SELECT COUNT(acadYear) as total
FROM financial_trans
GROUP BY acadYear
) s
but throws an error like below,
#1172 - Result consisted of more than one row