Skip to content
Advertisement

Tag: gaps-and-islands

Merge lines over timespan in SCD2 table

I’m having the following table sourced from a SCD2 table. From this source table, I have selected only a few columns, which reults in several lines looking exactly similar. I want to remove the unnecessary lines, those that contain the same data, and have the ValidFrom column showing the first value and ValidTo column showing the last value within “the

Select on value change

I have a table that looks like this in a MySQL database: I would like to select all lines where the Batch_Num is different from the previous value including the first one: Is there a keyword maybe to access the previous line to compare the to the current line? Or some other way to compare a line to the line

Advertisement