| From: | "Len Morgan" <len-morgan(at)crcom(dot)net> |
|---|---|
| To: | "Abe" <abe(at)fish(dot)tm>, <pgsql-general(at)postgresql(dot)org> |
| Cc: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
| Subject: | Re: Lower record |
| Date: | 2000-12-24 01:36:54 |
| Message-ID: | 003301c06d4a$05e0cd00$0908a8c0@H233.bstx.cc |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
>... I also cant use the following:
>
>$sql = "select threadid, commentid, name, detail from comments where
>commentid < '$commentid' and threadid='$threadid'";
>
>
> because it gets the lowest value comment whereas what I want is the
highest
>value comment but lower that $commentid (so basically the one immediately
>below this one).
How about:
select threadid, commentid, name detail from comments where
comentid < '$commentid' and threadid='$threadid'
ORDER BY commentid DESC LIMIT 1 ;
The ORDER BY ... DESC will put the highest commentid first and the LIMIT 1
will only return one record.
Len Morgan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Abe | 2000-12-24 01:52:58 | Re: Lower record |
| Previous Message | Abe | 2000-12-24 00:51:31 | Lower record |