$sql = "select *,appointment.ap_start From committeegroup";
$sql.= " INNER JOIN committee ON (committeegroup.gr_id=committee.gr_id)";
$sql.= " INNER JOIN appointment ON (appointment.pe_id = committee.pe_id)";
$sql.= " INNER JOIN personnel ON (committee.pe_id = personnel.pe_id)";
$sql.= " where (committeegroup.gr_id ='$gr_id' )and (appointment.ap_start like '%$ap_start%' )and ((appointment.ap_timestart Between '$me_timestart' And '$me_timestop' ) or ( appointment.ap_timestop Between '$me_timestart' And '$me_timestop' )and(('$me_timestop' <> appointment.ap_timestart ) and ('$me_timestart'<> appointment.ap_timestop)))";