This is a silly question, but I have been racking my brain over it for a couple of hours and need to look elsewhere for some assistance :P

I am trying to develop a built in 'recent article' list into a theme I am designing. The problem I am having is my search criteria is not factoring in sticky's correctly.

SELECT * FROM {node} WHERE `type` = 'story' AND `promote` = '1' ORDER BY `created` DESC LIMIT 6

I have moved back to my original query because any revisions I have made have not provided the results.

To sum up this post -> I need to get the above query to work exactly like drupal when it pulls the most recent articles by create date - but also factoring if it is a sticky.

Comments

feeper’s picture

I ended up with this - in case somebody needs it.

SELECT * FROM {node} WHERE `promote` = 1 AND `status` = 1 ORDER BY `sticky` DESC, `created` DESC LIMIT 0, 6

Thanks - Drupal on!

jix_’s picture

Why not use the views module for this? :)