ALTER SYSTEM SET optimizer_features_enable='11.2.0.3';
select
sum(case when date>now() - interval 7 day THEN index END) as sum1,
sum(case when date>now() - interval 14 day and date<now() - interval 7 day THEN index END) as sum2
from table
WHERE
date>now() - interval 14 day
SELECT
users.name
FROM users
INNER JOIN user_roles
ON user_roles.user_fk = users.user_id
INNER JOIN role_permissions
ON user_roles.role_fk = role_permissions.permission_fk
INNER JOIN permissions
ON user_roles.role_permission_id = permissions.id
WHERE
users.name='Ivan' AND permissions.name= 'auth-site'
<td class='firstCol'><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></td>
<td class='firstCol'><?if($arElem['SECTION'] == 2620) {?><b><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?></b><?} else {?><?=$arResult['INDICATOR_NAMES'][$arElem['SECTION']]?><?}?></td>
var properties_dot = {
balloonContentHeader: '', balloonContentBody: '',
hintContent: "",
iconContent: ""
},
options_dot = { balloonCloseButton: true,
iconImageHref: '/upload/uf/c27/green_social.png',
iconImageSize: [30, 31],
iconImageOffset: [-3, -31] };
placemark[0] = new ymaps.Placemark([59.194265, 39.912287], properties_dot, options_dot);
var clusterIcons = [{
href: '/upload/cluster.png',
size: [33, 33],
offset: [-16, -16]
},
{
href: '/upload/cluster_big.png',
size: [47, 47],
offset: [-23, -23]
}
];
var clusterNumbers = [100];
var cluster = new ymaps.Clusterer({clusterIcons: clusterIcons, clusterNumbers: clusterNumbers });
select id, sum(summa) over (order by id rows between unbounded preceding and 1 preceding ) as Itog from [dbo].[Operations]
union all
select NULL, SUM(summa) from [dbo].[Operations]
select [id], [data], [summa],
sum([summa]) over (order by [id]
rows between unbounded preceding and 1 preceding )
as [Itog],
sum([summa]) over ( ) as [Itog1]
from [dbo].[Operations]
select d1.id, SUM(d2.summa)
from [dbo].[Operations] d1 left join [dbo].[Operations] d2
ON( d1.id > d2.id )
group by rollup(d1.id)
order by d1.id