SELECT * FROM rabota WHERE id in( SELECT id FROM rabota WHERE ispol='$ispol' AND vremya BETWEEN '$date1' AND '$date2' )