I have a table of publications.
-- Table structure for news
-- ----------------------------
CREATE TABLE `news` (
  `id` int(100) NOT NULL auto_increment,
  `content` longblob,
  `title` varchar(100) default NULL,
  `date` date default NULL,
  `display` varchar(10) default 'no',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- the column display = 'yes'; if the article is to be dispalyed on the homepage. I only have 2 yes columns equal to yes at any one time. SELECT * FROM news WHERE display='yes' ORDER BY id desc limit 1 Think this would get the lastest article that is to be displayed but how do I get the second one. R.

The simple way: use LIMIT 1, 1. A variety of more general techniques are explained here: http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/

Baron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to