現在、他のプログラマーの 1 人がこのビューを作成して、6 か月の間隔を表示しています。月ごとにグループ化された12か月の間隔を2011年のみ表示するようにするにはどうすればよいですか
月ごとにグループ化された12か月の別のビューにコピーしたいのですが、2012年のみです
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%`
SQL SECURITY DEFINER VIEW `vw_dash_bymonth`AS
select
month(from_unixtime(`tbl_services`.`datetime`)) AS` month1`,
date_format(from_unixtime(`tbl_services`.`datetime`),'%Y') AS` year1`,
date_format(from_unixtime(`tbl_services`.`datetime`),'%d') AS `day1`,
`tbl_services`.`datetime` AS `realdate`,sum(`tbl_services`.`gallons`) AS `gallons`,
count(0) AS `service`,
round(avg(`tbl_services`.`gallons`),1) AS `average`
from `tbl_services`
where (from_unixtime(`tbl_services`.`datetime`) > (now() - interval 6 month))
group by month(from_unixtime(`tbl_services`.`datetime`))