Re: [GENERAL] SELECT issue with references to different tables

2012-06-03 Thread Alexander Reichstadt
Hi Misa, I have such a construct with kind of an auxiliary table that is only there to keep the current status. I made good experiences with it and the overhead of maintaining an additional table for a current status alongside a table for tracking a historical buildup is negligable and works pr

Re: [GENERAL] SELECT issue with references to different tables

2012-06-03 Thread Misa Simic
Hi Alex, I think would be better to reorganise model to awoid NULLs i.e. to includ new table: owners -owner_id -owner_name -ownertype (person/comapny) and have yours person_details table... and comapny_details_table... related 1:1 to owner_id However, solution for your way I think would be:

Re: [GENERAL] SELECT issue with references to different tables

2012-06-02 Thread David Johnston
On Jun 2, 2012, at 14:50, Alexander Reichstadt wrote: > Hi, > > I have a query I cannot figure out in postgres or actually in any other way > than using the client front end, which I would prefer not to do. > > So, I have 4 tables > > pets > persons > companies > pets_reference > > pets have

Re: [GENERAL] SELECT issue with references to different tables

2012-06-02 Thread Chris Angelico
On Sun, Jun 3, 2012 at 4:50 AM, Alexander Reichstadt wrote: > So, I have 4 tables > > pets > persons > companies > pets_reference > > pets have owners, the owner at any point in time is either a persons or a > company, never both at the same time. > > A pet owner can change to persons A, resultin