Reply to Re: MySQL list, relative to one post.

Your name:

Reply:


Posted by Oli Filth on 11/16/05 18:07

Sandman wrote:
>
> what I would like is something like this:
>
> select * from blog where member = 12 and category = 'Sports' and id = 12345
> limit -5, 5;

SELECT * FROM blog
WHERE ... AND id < $currentID
ORDER BY id DESC
LIMIT 5
UNION
SELECT * FROM blog
WHERE ... AND id >= $currentID
ORDER BY id
LIMIT 6

Second limit needs to be 6 to make sure the current ID is included.

--
Oli

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация