increment/rank

Поиск
Список
Период
Сортировка
От Dan Harrington
Тема increment/rank
Дата
Msg-id PPELIKJMPHIIPOBOPEKGKEIODCAA.dan@tudan.net
обсуждение исходный текст
Ответы Re: increment/rank  (Matt Beauregard <matt@designscape.com.au>)
Список pgsql-general
Hello,

I am looking for a way to create an increment value for an image
database....
using an SQL database...let's say of some bodies of water:

table water
----------------------------------------------------------------------------
-
image title        |    URL            | keywords             | rank
----------------------------------------------------------------------------
-
Peaceful Stream    |    image/stream.jpg    | water peace        | 102
Wide Stream        |    image/wide.jpg    | water peace flowing    | 101
Rushing River    |    image/river.jpg    | water rushing river    | 100
Deep Ocean        |    image/ocean.jpg    | water tide ocean    | 99
Dashing Waterfall    |    image/falls.jpg    | water fall cliff    | 98

select * from water where keywords like '%water%' and keywords like
'%peace%' order by rank;

I get a two-record list of:
----------------------------------------------------------------------------
-
Peaceful Stream    |    image/stream.jpg    | water peace        | 102
Wide Stream        |    image/wide.jpg    | water peace flowing    | 101
----------------------------------------------------------------------------
-
...and I select "Wide Stream", I want to change the rank number from 101 to
102.

etc etc etc.

any ideas?  I have searched far and wide in the documentation and I am
not seeing the answer aside from just duplicating the entire row
and incrementing the rank number, and then deleting the old record...but
that seems like a pathetic solution.

Thanks
Dan Harrington




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

Предыдущее
От: "Brett W. McCoy"
Дата:
Сообщение: Re: src/Makefile.global
Следующее
От: Matt Beauregard
Дата:
Сообщение: Re: increment/rank