LEFT JOIN ([Orders]) LOAD Order ,if("Contains ABC" and not "Contains ERT","Order") as "ABC Order" ,if("Contains ERT" and not "Contains ABC","Order") as "ERT Order" ; LOAD Order ,max(match(Product,'A','B','C'))>0 as "Contains ABC" ,max(match(Product,'H','J','K'))>0 as "Contains HJK" // Not actually needed ,max(match(Product,'E','R','T'))>0 as "Contains ERT" RESIDENT [Order Details] GROUP BY Order ;