WITHRECURSIVEancestor(id,mtime)AS(SELECTid,mtimeFROMcheckinWHEREid=@BASELINEUNIONSELECTderivedfrom.xfrom,checkin.mtimeFROMancestor