MySQL ERROR:

Error Number: 1064

Description: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE t.entry_id !='' AND t.entry_date < 1511271661 AND (t.expiration_date = 0' at line 2

Query: SELECT t.entry_id FROM exp_weblog_titles AS t LEFT JOIN exp_weblogs ON t.weblog_id = exp_weblogs.weblog_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id INNER JOIN exp_weblog_data AS d ON t.entry_id=d.entry_id AND WHERE t.entry_id !='' AND t.entry_date < 1511271661 AND (t.expiration_date = 0 || t.expiration_date > 1511271661) AND exp_weblogs.is_user_blog = 'n' AND t.weblog_id = '6' AND t.status = 'open' AND t.status != 'closed'