Forums

This topic is locked

Define recordset for recent articles

Posted 27 Feb 2006 16:49:46
1
has voted
27 Feb 2006 16:49:46 Gary Hynes posted:
I am trying to define a recordset to grab the 4 "previous" postings in my database, based on the primary ID. I don't want the most recent posting to display.

eg..

SELECT *
FROM tablename
WHERE ((tablename.id_story = <b>???4 previous postings</b>

I'm sure this is pretty basic stuff, but any help to a newbie would be most appreciated!<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Replies

Replied 03 Mar 2006 18:33:04
03 Mar 2006 18:33:04 Roddy Dairion replied:
Is that any 4 previous posting or 4 previous posting before the most recent one???
Replied 03 Mar 2006 19:33:16
03 Mar 2006 19:33:16 Roddy Dairion replied:
try this out let me know if it works.

select * from tablename group by id_story having max(id_story) &lt; (select max(id_story) from tablename) order by id_story DESC limit 4

Let me know if and hope it works.

Reply to this topic