There are a couple of sql queries of the following content (part of the query is omitted for simplicity):
select count(*) from ext_restriction er where er.proceed = '1' and
select count(*) from ext_restriction er where er.proceed = '0' In principle, everything works fine, but it turned out that the ext_restriction table can have several rows with the same value in the act_id field and need to convert the query so that it works as follows: when counting the number of rows, the rows with the same act_id value should be taken into account only once, act_id , if at least in one of the lines with the same act_id the proceed = '1' flag is proceed = '1' , then they should be taken into account in the first request and should not be taken into account in the second and vice versa.