Search Postgresql Archives

Re: Can I getting a unique ID from a select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 05, 2007 at 17:07:25 -0800,
  Timasmith <timasmith@xxxxxxxxxxx> 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?


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux