Answer the question
In order to leave comments, you need to log in
How to display the difference between two fields?
Hello!
There is such a request. Tell me, please, how can I implement the output of a new field, in which the value of the difference between the fields "Total children" will be "18.1"?
The field "Total children" itself is not needed as a result at all, it would be necessary to specifically display the value of the difference between the two fields instead of it.
Request link: https://ps.tmpc.ru/ac78abbfae86
Answer the question
In order to leave comments, you need to log in
Well, write the difference right away:
select
region_code, ...
sum(case when status_id = 2 then 1 else 0 end) - sum(case when consul_need_id = 3 then 1 else 0 end) as diff, ...
select t.*,
"Всего детей",
"Всего детей" - "18.1",
"18.1" * "До года жизни" / ("7.1" + "8.1")
...
from (
select
region_code, sum(case when age_group_id < 13 then 1 else 0 end) as "До года жизни",
....
) t
(sum(case when ... end),0)
- why do you need it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question