postgresql - SQL: Group by attributes from one table but not the other in a join? -
essentially have 2 tables joined need group attributes in first table, not second.
i can this...
select "table1".*
...to produce columns first table in output. following results in error when trying group them...
group "table1".*
is there way group them elements in first table without typing individual columns in table1?
postgres supports ansi feature called functional dependency. so, if have unique id in table1
, can aggregate that:
select t1.* table1 t1 group t1.id;
the id
has declared correctly either primary key or unique key.
Comments
Post a Comment