|
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]
Navigation:
[Reply to this message]
|