Re: Lower record

Поиск
Список
Период
Сортировка
От Abe
Тема Re: Lower record
Дата
Msg-id 00a801c06d4c$3fcb3d00$6500a8c0@win2k
обсуждение исходный текст
Ответ на Lower record  ("Abe" <abe@fish.tm>)
Список pgsql-general
Thanks Len,

works a treat...

Abe

----- Original Message -----
From: "Len Morgan" <len-morgan@crcom.net>
To: "Abe" <abe@fish.tm>; <pgsql-general@postgresql.org>
Cc: "Christopher Kings-Lynne" <chriskl@familyhealth.com.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
>
>


В списке pgsql-general по дате отправления:

Предыдущее
От: "Abe"
Дата:
Сообщение: Lower record
Следующее
От: "Aaron Rouse"
Дата:
Сообщение: Changing Datatypes