Select taxmonth, sum(cast(clothing as int)+cast(electronics as int)+cast(sports as int)) as total_sales From eshop Group by taxmonth order by total_sales desc limit 1 this als works
no this is syntax wise all instead you can use this Select taxmonth, sum(cast(clothing as int)+cast(electronics as int)+cast(sports as int)) as total_sales From eshop Group by taxmonth order by total_sales desc limit 1
explanation 👌
Thanks for posting the problem along with data set
select top 1 txnmonth, (clothing+electronics+sports) AS amount
from eshop
ORDER BY amount DESC;
Select taxmonth, sum(cast(clothing as int)+cast(electronics as int)+cast(sports as int)) as total_sales
From eshop
Group by taxmonth
order by total_sales desc
limit 1
this als works
Cant we do this
Select taxmonth, Max(clothing+electronics+sports)
From eshop
Group by 1
no this is syntax wise all
instead you can use this
Select taxmonth, sum(cast(clothing as int)+cast(electronics as int)+cast(sports as int)) as total_sales
From eshop
Group by taxmonth
order by total_sales desc
limit 1