|
Ограничение по дате с участием @ReportDate
|
|||
---|---|---|---|
#18+
Пытаюсь через 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 ... |
|||
:
Нравится:
Не нравится:
|
|||
16.03.2021, 18:45 |
|
|
start [/forum/topic.php?fid=46&fpage=30&tid=1684947]: |
0ms |
get settings: |
8ms |
get forum list: |
13ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
27ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
28ms |
get tp. blocked users: |
2ms |
others: | 12ms |
total: | 109ms |
0 / 0 |