Using from and to criterias for other queries