On 15 Jul 2015, at 2:07pm, Daniel Polski <daniel at agelektronik.se> wrote:
> Or if there is a more elegant solution I haven't thought about? I would suggest here that you rethink your reason for needing three tables table_1, table_2 and table_3. It looks more like you need only one table here, with 'id', 'starttime' and 'endtime' columns. 'endtime' stays at NULL until an endtime is known. Often, when you find something that mixes FOREIGN KEYs with TRIGGERs, it's a danger warning. Not always, just often. Simon.