Hi, I've spent too long staring at code today and am facing a bit of a block when trying to figure out how to best implement the following. I'm basically looking at tracking versions of some configuration items saved in a database table. My thinking of the table is something along the following : create table templates( template_id int not null primary key, template_groupid int not null, template_version int not null template_text text not null); My thinking on the above is : - template_id is a unique ID for that version - template_groupid identifies the set the template belongs to - version is the version Would I need to resort to using a CTE or subquery to make this sort of thing work ? I can't seem to make it work with group by since group by expects aggregation. Surely I don't need to normalise it into a couple of tables ? Sorry if its a silly question ! Tim -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general