Re: Lower record

Поиск
Список
Период
Сортировка
От Len Morgan
Тема Re: Lower record
Дата
Msg-id 003301c06d4a$05e0cd00$0908a8c0@H233.bstx.cc
обсуждение исходный текст
Ответ на Lower record  ("Abe" <abe@fish.tm>)
Список 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



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

Предыдущее
От: "Emmanuel Charpentier,,,"
Дата:
Сообщение: NULLS and <> : Discrepancies ?
Следующее
От: "Rod Taylor"
Дата:
Сообщение: Re: [HACKERS] Merry X-Mass