Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
agat 21.01.2007 14:12
ваш совет подошел как нельзя кстати.################################################ @getDailyStatistics[hParams] $hParams[^hash::create[$hParams]] $result[^pSQL.table{ SELECT dt_counted, SUM(CASE WHEN article_id = 0 THEN read_count ELSE 0 END) AS visits, COUNT(DISTINCT CASE WHEN article_id != 0 THEN article_id END) AS articles, SUM(CASE WHEN article_id != 0 THEN read_count ELSE 0 END) AS readings FROM site_statistics ^if(def $hParams.where){ WHERE $hParams.where } GROUP BY dt_counted ORDER BY dt_counted }[ ^if(def $hParams.limit){$.limit($hParams.limit)} ^if(def $hParams.offset){$.offset($hParams.offset)} ]] # end of @getDailyStatistics[] ################################################ @getDailyStatisticsCount[hParams] $hParams[^hash::create[$hParams]] $result[^pSQL.int{ SELECT COUNT(*) FROM ( SELECT COUNT(*) FROM site_statistics ^if(def $hParams.where){ WHERE $hParams.where } GROUP BY dt_counted ) AS T }] # end of @getDailyStatisticsCount[]