There is a request for one line
select * from ( select case when not exists (select 1 from cast (json_extract_path_text(json_array_elements('[{"id":"10058432","bdate":"04.04.2016"},{"id":"10058433","bdate":"01.01.2015"}]'::json),'bdate') as date) where json_extract_path_text between (SELECT create_date from mc_case WHERE closing_step_id = 1) and (SELECT close_date from mc_case WHERE closing_step_id = 1) ) then TRUE else false END from cast (json_extract_path_text(json_array_elements('[{"id":"10058432","bdate":"04.04.2016"},{"id":"10058433","bdate":"01.01.2015"}]'::json),'bdate') as date) group by 1 ) cases where not FALSE; How to add a field to the output, which would, when else false , display an additional field (query - which already works with the id field, where case returned false )