add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select version();
version()
8.0.30
create table payment (payment_date date, amount int);
SELECT
quarter(payment_date) quarter,
monthname(payment_date) month_name,
SUM(amount) monthly_sales,
SUM(amount) OVER() max_overall_values,
SUM(amount) OVER(PARTITION BY quarter(payment_date)) max_quarter_sales
FROM
payment
WHERE
year(payment_date) = 2005
GROUP BY
quarter(payment_date),
monthname(payment_date)
ORDER BY
monthname(payment_date) DESC;
Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'fiddle.payment.amount' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
set session sql_mode=replace(@@sql_mode,'ONLY_FULL_GROUP_BY','');
SELECT
quarter(payment_date) quarter,
monthname(payment_date) month_name,
SUM(amount) monthly_sales,
SUM(amount) OVER() max_overall_values,
SUM(amount) OVER(PARTITION BY quarter(payment_date)) max_quarter_sales
FROM
payment
WHERE
year(payment_date) = 2005
GROUP BY
quarter(payment_date),
monthname(payment_date)
ORDER BY
monthname(payment_date) DESC;
quarter month_name monthly_sales max_overall_values max_quarter_sales