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 ') AND O.deleted=0 AND O.date >="2019-11-21" ORDER BY O.date )' at line 10
Array
(
    [0] => Error Number: 1064
    [1] => 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 ')
					AND O.deleted=0 
					AND O.date >="2019-11-21" 
				ORDER BY O.date
			)' at line 10
    [2] => 
			SELECT *
			FROM (
				SELECT P.id, O.mlsNum,
					DATE_FORMAT(O.date,"%c/%e/%Y") AS date,
					TIME_FORMAT(O.timeStart,"%l:%i%p") AS timeStart,
					TIME_FORMAT(O.timeEnd,"%l:%i%p") AS timeEnd,
					IF(O.listingAgent = "", P.agent, O.listingAgent) AS listingAgent, IF(O.listingOffice = "", P.listingOffice, O.listingOffice) AS listingOffice
				FROM RETS_OpenHouses AS O
				JOIN RETS_Property AS P ON (O.uniqIDProp=P.uniqID AND O.feed=P.feed)
				WHERE P.id IN()
					AND O.deleted=0 
					AND O.date >="2019-11-21" 
				ORDER BY O.date
			) AS T
			GROUP BY T.id;
		
)