After some help from here (thankyou to those guys) I've got this query:
$query2 = 'SELECT sq.link_id
FROM ( SELECT li.link_id, SUM( li.cat_id ) AS score
FROM linkindex li
WHERE li.word_id IN ('.$word_id_list.') '.$cat_filter.'
GROUP BY li.link_id
JOIN links_date_duration ldd
ON sq.link_id = ldd.link_id
WHERE ldd.link_duration '.$dur_range.'
AND ldd.link_date '.$date_range.'
ORDER BY sq.score DESC
PHP feeds in various values and everything is working fine.
My question is to further extend this query to NOT INCLUDE certain word_id's - At the mo it returns values with fed in word_ids:
WHERE li.word_id IN ('.$word_id_list.')
What I now want to do is to return these results but EXCLUDE results that contain specific word_ids.
At first I thought:
WHERE li.word_id IN ('.$word_id_list.') AND word_id != '.$exclude_id.'
OR a multiple variant
WHERE li.word_id IN ('.$word_id_list.') AND word_id NOT IN ('.$exclude_id_list.')
But that did nothing - and then I thought adding a HAVING in there might work but to be honest I don't understand it enough quite yet so thought someone here could easily point me in the right directinn :)
Again, huge thanks for your input.