1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/MarcoMaHH-rent2

Клонировать/Скачать
dev_detail_electricity.sql 859
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
最常用 Отправлено 28.08.2022 14:21 4c3f430
select `a`.`id` AS `id`,`a`.`type` AS `type`,unix_timestamp(concat(`a`.`month`,'-01')) AS `month`,`a`.`dosage` AS `dosage`,round(`a`.`sum`,2) AS `sum` from (select `b`.`id` AS `id`,`b`.`type` AS `type`,date_format(`a`.`start_time`,'%Y-%m') AS `month`,(case when (`b`.`type` = 'B') then sum(`a`.`electricity_consumption`) when (`b`.`type` = 'C') then sum(`a`.`water_consumption`) end) AS `dosage`,(case when (`b`.`type` = 'B') then sum(cast(`a`.`electricity` as char charset binary)) when (`b`.`type` = 'C') then sum(cast(`a`.`water` as char charset binary)) end) AS `sum` from (`dev`.`dev_house_billing` `a` join `dev`.`dev_bill_electricity` `b` on((`a`.`house_property_id` = `b`.`house_property_id`))) where find_in_set(`a`.`house_number_id`,`b`.`house_number_id`) group by date_format(`a`.`start_time`,'%Y-%m'),`b`.`id`,`b`.`type`,`b`.`house_number_id`) `a`

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/MarcoMaHH-rent2.git
git@api.gitlife.ru:oschina-mirror/MarcoMaHH-rent2.git
oschina-mirror
MarcoMaHH-rent2
MarcoMaHH-rent2
master