Re: Lower record

From: "Abe" <abe(at)fish(dot)tm>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Lower record
Date: 2000-12-24 01:52:58
Message-ID: 00a801c06d4c$3fcb3d00$6500a8c0@win2k
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Len,

works a treat...

Abe

----- Original Message -----
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>
Sent: Sunday, December 24, 2000 1:36 AM
Subject: Re: [GENERAL] Lower record

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Aaron Rouse 2000-12-24 05:38:25 Changing Datatypes
Previous Message Len Morgan 2000-12-24 01:36:54 Re: Lower record