Re: How do you select from a table until a condition is met?

Поиск
Список
Период
Сортировка
От Nicholas Allen
Тема Re: How do you select from a table until a condition is met?
Дата
Msg-id 200302122153.08970.nallen@freenet.co.uk
обсуждение исходный текст
Ответ на Re: How do you select from a table until a condition is met?  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: How do you select from a table until a condition is met?  (Dmitry Tkach <dmitry@openratings.com>)
Список pgsql-sql
Ok I thought of that but what happens if there is no primary key in the table?
I can probably add primary keys to the table but I didn't design the tables
and so I have little (but luckily some) say over what columns appear in them.
What has actually happened is that we have a view on a table and the view
doesn't return the primary key.  I'll try and ask the database administrator
to add the primary keys.

Thanks for the help though I guess it is the only way to do it. I was just
hoping there would be a way to do it without a promary key to prevent changes
to our database views.

On Wednesday 12 Feb 2003 9:37 pm, Bruno Wolff III wrote:
> On Wed, Feb 12, 2003 at 20:55:21 +0100,
>
>   Nicholas Allen <nallen@freenet.co.uk> wrote:
> > I thought of this but the problem is that there may be multiple rows with
> > the same value for the column I am sorting on. Eg if sorting on a surname
> > then there may be 100s of people with the same surname so generating a
> > where clause that selects up to the exact person previously selected is
> > very difficult.
>
> Then you should sort on surname AND whatever you are using as the primary
> key.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



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

Предыдущее
От: Dmitry Tkach
Дата:
Сообщение: Re: null foreign key column
Следующее
От: Dmitry Tkach
Дата:
Сообщение: Re: How do you select from a table until a condition is met?