All pastes #208445 Raw Edit

Untitled

public sql v1 · immutable
#208445 ·published 2006-10-18 16:54 UTC
rendered paste body
-- show the expenses for each month, yields 30 recordsSELECT DATE_FORMAT(day, '%Y-%m') as month, FORMAT(SUM(amount), 2) as sumFROM tt_financesGROUP BY YEAR(day), MONTH(day)-- get the number of different months with expenses, should yield 1 record, but yields 30 records with counts between 1 and 34SELECT COUNT(1)FROM tt_financesGROUP BY YEAR(day), MONTH(day)