INSERT INTO transfer_type (direction, description, sortkey) VALUES ('in', 'assembled', (SELECT COALESCE(MAX(sortkey), 0) + 1 FROM transfer_type));
INSERT INTO transfer_type (direction, description, sortkey) VALUES ('in', 'assembled', (SELECT COALESCE(MAX(sortkey), 0) + 1 FROM transfer_type));