You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND DATEDIFF(nhu_prices.datEnd, nhu_prices.datStart) < 14 AND price > 0 AND WEEK' at line 1