powered by simpleCommunicator - 2.0.51     © 2025 Programmizd 02
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / Ограничение по дате с участием @ReportDate
1 сообщений из 1, страница 1 из 1
Ограничение по дате с участием @ReportDate
    #40054259
elay13
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Пытаюсь через dateadd и @ReportDate сделать ограничение по месяцу вместо использования appl_month. Подскажите как правильно это сделать.

Примерный запрос:

DECLARE @ReportDate date
SET @ReportDate = '01.09.2020'
select appl_month
, (sum(case when financed = 1 and appl_month = '2020-07' then app_PS_2mob end)
/ sum(case when financed = 1 and appl_month = '2020-07' then cash_to_client end))
/ cast((sum(case when financed = 1 and appl_month = '2020-07' then app_PS_1mob end)
/ sum(case when financed = 1 and appl_month = '2020-07' then cash_to_client end)) as float) as Рои2наРои1_07

, (sum(case when financed = 1 and appl_month = '2020-06' then app_PS_2mob end)
/ sum(case when financed = 1 and appl_month = '2020-06' then cash_to_client end))
/ cast((sum(case when financed = 1 and appl_month = '2020-06' then app_PS_1mob end)
/ sum(case when financed = 1 and appl_month = '2020-06' then cash_to_client end)) as float) as Рои2наРои1_06

from DWH
where date_time >= '01-01-2020'
and date_time <='12-31-2020'
group by appl_month
order by appl_month
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / Ограничение по дате с участием @ReportDate
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]