diff --git a/screening/source/sql/postgresql/migration/migration-008-009.sql b/screening/source/sql/postgresql/migration/migration-008-009.sql index 54d146739b65a4115b32e4e70ad2b102c6ce879b..44ca7e1de822638d67ba5149b37c28b7bedf8519 100644 --- a/screening/source/sql/postgresql/migration/migration-008-009.sql +++ b/screening/source/sql/postgresql/migration/migration-008-009.sql @@ -35,9 +35,9 @@ CREATE TRIGGER CHANNEL_STACKS_CHECK BEFORE INSERT OR UPDATE ON CHANNEL_STACKS --- for each spot set exactly one representative channel_stacks record (with minimal id) --------- -update channel_stacks as cs - set cs.is_representative = 'T' - where cs.id in (select min(cs.id) +update channel_stacks + set is_representative = 'T' + where id in (select min(cs.id) from channel_stacks cs join spots on spots.id = cs.spot_id group by spots.id) \ No newline at end of file