Re: Can I getting a unique ID from a select
От | Bruno Wolff III |
---|---|
Тема | Re: Can I getting a unique ID from a select |
Дата | |
Msg-id | 20070307034826.GA20089@wolff.to обсуждение исходный текст |
Ответ на | Re: Can I getting a unique ID from a select ("Timasmith" <timasmith@hotmail.com>) |
Список | pgsql-general |
On Mon, Mar 05, 2007 at 17:07:25 -0800, Timasmith <timasmith@hotmail.com> wrote: > > > > > > > create view myview as > > > > > select rownum, t1.field, t2.field > > > > > from tableOne t1, tableTwo t2 > > > > > where t1.key = t2.fkey > > Multiple rows with the same key renders Hibernate useless as it caches > the 'row object' and then returns the first row every time for that > object. > > I think the sequence will work though, in reflection I guess it would > as fast as pulling another field, and with the numbers would be a very > long time before getting duplicates - even if you had thousands of > users, returning 100s of rows every few minutes (I think...). Based on the naming (t1.key vs t2.fkey) it looks like you may have a one to many relationship. If so, can't you just bring in the primary key from t2, as under the above assumption there will be only one matching row from t1?
В списке pgsql-general по дате отправления: