Search Postgresql Archives

Re: Using complex PRIMARY KEY

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

 



In response to Zsolt :
> 
> This is our first project using PostgerSQL, where I have a problem I cant solve
> on a neat way (I assume PGSQL should provide a nice solution...).
> 
> So we have an old xBase based program we are trying to port to PostgreSQL while
> we should keep the original data structure especially the ID fields must be
> kept as this IDs are already used in other systems.
> 
> The problem is with two table, one is storing the data of houses the other the
> data of tenants in a given houses.
> 
>  
> 
> For a given house I would like to start the numbering of tenants from 1. Each
> house could have tenant_ID=1, obviously in this case the house_ID will differ.
> The combination of tenant_ID and house_ID will be the unique identifier of each
> tenant.

Do you have PostgreSQL 8.4?

If yes, you can use CTE-functions for that. row_number().

Unfortunately, at the moment i haven't access to my database to create
an example, maybe later.


Regards, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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