Jump to content

SQL


aftab_jii

Recommended Posts

i want to show last two posts where posts with category About Me and Our Services are skipped.

i managed to do it with the query below, but it only returns one post if the next post has category About Me or Our Services.

i want the sql to skip the two categories and show two posts

 

$sql = "SELECT article_id FROM articles WHERE is_published=1 AND category <> 'About Me' AND category <> 'Our Services' ORDER BY date_published DESC LIMIT 0,2";
$sql_result = mysql_query($sql)
			or die('Could not run query; ' . mysql_error());

 

i tried with SKIP (category = 'About Me') but got an error

Link to comment
https://forums.phpfreaks.com/topic/198654-sql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.