Error!
MySQL Error: 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 locations.country='US' AND address_states.country_id IN(SELECT id FROM addre' at line 1
SQL Statement: SELECT address_states.*, count(DISTINCT contents.id) as count FROM contents JOIN content_taxonomy on content_taxonomy.content_id = contents.id JOIN content_locations on content_locations.content_id=contents.id JOIN locations on content_locations.location_id=locations.id JOIN address_states on address_states.code=locations.state JOIN asset_packages on asset_packages.resource_id = contents.id WHERE contents.content_type_id = AND locations.country='US' AND address_states.country_id IN(SELECT id FROM address_countries WHERE iso_code='US') AND address_states.code!='' and contents.publish_date <= '2024-05-19 11:00:00' and contents.published=1 and contents.magazine_id=6 and asset_packages.published = 1 and asset_packages.resource = contents.resource_id and asset_packages.expire_at>= '2024-05-19 11:00:00' and locations.country='US' group by address_states.name ORDER BY address_states.name asc