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

Your name:

Reply:


Posted by Sandman on 11/16/05 19:58

In article <1132157223.443017.320790@z14g2000cwz.googlegroups.com>,
"Oli Filth" <catch@olifilth.co.uk> wrote:

> 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.

Whoa - that looks like it's something!

But that will actually run two queries in the SQL-server, right? But still, I
get both in the same pass. I'll try it out. Thanks!


--
Sandman[.net]

[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

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