Is there a way to have an "automatic" join in postgresql? -


i mean following: have 2 parent tables :

table1 id primary key name text

table2 id primary key ...

and child table, used fo n-n relations : table_child id primary key id_1 int id_2 int

where id_1 , id_2 in table_child refer column id in table1 , table2.

now : perform request, join between table_1 , table_child on table1.id = table_child.id1, because need value of column table1.name. i'm wondering if there way avoid these joins, , declare somehow "pseudo" column name in table_child, not real column, link corresponding column in table_1, : * can acces value through table_child.name * synchronized value table1.name

i hope explanation understandable...

further comment above, answer you're looking like:

create view     table1_child_view select     table1.name,     table1_child.*     table1_child inner join     table1 on         table1.id = table1_child.id_1 

then can run queries on new view, such as:

select name table1_child_view ... 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -