Re: Re: record pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



elk dolk wrote:

Chris <dmagick@xxxxxxxxx> wrote:
Huh? You want before, after and including? So everything?

Maybe give us an example of what you want to get out of the query rather than us guessing.

I keep the path to my photos in this DB so it is a photo Gallery , when I click on a thumbnail  I want to see the image detail and then scroll to the next or previous photos with the same category.

Not a great query but see if this returns what you want:

SELECT id, name, cat FROM table t2
WHERE cat = (SELECT cat FROM table t1 WHERE id = $ID) AND (t2.id = t1.id - 1 OR t2.id = t1.id + 1);

I'm sure there's a much better way to do this however.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux