Re: Re: record pointer
| From: | Chris | Date: | Fri, 06 Jul 2007 06:45:32 +0000 |
| Subject: | Re: Re: record pointer | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43762@lists.php.net to get a copy of this message | ||
elk dolk wrote:
Chris <dmagick@gmail.com> 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/