If there is an image that has an open and a closed case
return cases ;return #1 that is open ;return #1 that is closed ;return images ;return number of  #2 for each  #4 ;return #4 where  #5 is at least one ;return number of  #3 for each  #6 ;return #6 where  #7 is at least one ;return number of  #8 ;return if  #9 is at least one
['select', 'filter', 'filter', 'select', 'group', 'comparative', 'group', 'comparative', 'aggregate', 'boolean']