Something is wrong in your syntax obok ') OR (NOW() BETWEEN pp.start_date AND pp.end_date AN...' w linii 7