Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

so-57418970

Language: Layout:
+ ] Show input
Absolute running time: 0.12 sec, cpu time: 0.06 sec, memory peak: 8 Mb, absolute service time: 0,13 sec 
fork mode |  history
            select (
              select ID
              from company cmp
              where cmp.country = cnt.country
                and cmp.color   = clr.color
                and cmp.price between 2.5 AND 4.5
              order by cmp.price desc
              limit 1
              offset 0
            ) as ID
            from country_list cnt
            cross join color_list clr
            having ID is not null
         UNION ALL 
            select (
              select ID
              from company cmp
              where cmp.country = cnt.country
                and cmp.color   = clr.color
                and cmp.price between 2.5 AND 4.5
              order by cmp.price desc
              limit 1
              offset 1
            ) as ID
            from country_list cnt
            cross join color_list clr
            having ID is not null
         UNION ALL 
            select (
              select ID
              from company cmp
              where cmp.country = cnt.country
                and cmp.color   = clr.color
                and cmp.price between 5.5 AND 8.2
              order by cmp.price desc
              limit 1
              offset 0
            ) as ID
            from country_list cnt
            cross join color_list clr
            having ID is not null
         UNION ALL 
            select (
              select ID
              from company cmp
              where cmp.country = cnt.country
                and cmp.color   = clr.color
                and cmp.price between 5.5 AND 8.2
              order by cmp.price desc
              limit 1
              offset 1
            ) as ID
            from country_list cnt
            cross join color_list clr
            having ID is not null
         UNION ALL 
            select (
              select ID
              from company cmp
              where cmp.country = cnt.country
                and cmp.color   = clr.color
                and cmp.price between 8.5 AND 10.8
              order by cmp.price desc
              limit 1
              offset 0
            ) as ID
            from country_list cnt
            cross join color_list clr
            having ID is not null
         UNION ALL 
            select (
              select ID
              from company cmp
              where cmp.country = cnt.country
                and cmp.color   = clr.color
                and cmp.price between 8.5 AND 10.8
              order by cmp.price desc
              limit 1
              offset 1
            ) as ID
            from country_list cnt
            cross join color_list clr
            having ID is not null
        

    
                
λ
.NET NoSQL database for rapid development