AND NOT, doesnot work php sql?

I am not the best at sql and php, but.
I am easier with .net apps and sql query.

How do you include or exlude a specific list of items based on a set id like “cat_id”, exlude specifi cat_id?

What is correct way to write it?


	$db	 =& JFactory::getDBO();
	
	$query  = "	SELECT
							* 
					FROM
							".$db->nameQuote('#__community_videos')."
					WHERE
							".$db->nameQuote('published')."=".$db->quote(1)."
					AND
							".$db->nameQuote('permissions')."=".$db->quote(0)."
					AND NOT
						                ".$db->nameQuote('cat_id')."=".$db->quote(5)."
																																								
					ORDER BY
							".$db->nameQuote('created')." DESC
					LIMIT 
							".$limit;

	$db->setQuery( $query );
	
	$result = $db->loadObjectList();







Try this I’m not expert but maybe it works

	$db	 =& JFactory::getDBO();
	
	$query  = "	SELECT
							* 
					FROM
							".$db->nameQuote('#__community_videos')."
					WHERE
							".$db->nameQuote('published')."=".$db->quote(1)."
					AND
							".$db->nameQuote('permissions')."=".$db->quote(0)."
					AND
						                ".$db->nameQuote('cat_id')."!=".$db->quote(5)."
																																								
					ORDER BY
							".$db->nameQuote('created')." DESC
					LIMIT 
							".$limit;

	$db->setQuery( $query );
	
	$result = $db->loadObjectList();

you know use

AND anything!=anythingelse

in replace to

AND NOT

to exclude a single value

AND field1 <> 'value'

to exclude multiple values

AND field1 NOT IN ('value1', 'value2', ...)