I have a db table that contains a score information for each user with each item. I want to get the scores of the items not seen (not added to the shopping cart or wish list) by the user. I have this query:
$query = $this->db->query("
select product_id
, score
from score where ( customer_id= '$customer_id' and product_id not in (
( select product_id from cart where customer_id= '$customer_id' )
UNION
( select product_id from customer_wishlist where customer_id= '$customer_id' )
) )
order by score desc
limit 4");
but I've got the following fatal error:
Uncaught exception 'Exception' with message '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 'UNION (select product_id from customer_wishlist where customer_id= '8') ))
any help?