select tmpReport.*,; L1.* ; from tmpReport, LiquidationPrice L1 ; into cursor tmp ; where ( (bintoc(tmpReport.artparent) + dtos(tmpReport.PlanMonday)) ; in ( select max( bintoc(liquidationprice.article) + dtos(liquidationprice.planweek) ) ; from LiquidationPrice L2 ; where ( bintoc(L2.article) == bintoc(tmpReport.artparent) ) ; ) ; )