I have a SQL data like this:
id date_start date_end identical_value
1 1 1 a
2 1 3 b
3 2 3 c
I need return multiple semi-identical results, but only with ID and a new column. Below an example:
id date_reference identical_value
1 1 a
2 1 b
2 2 b
2 3 b
3 2 c
3 3 c
Note that the column date_reference
starts on date_start
and end on date_end
.
I have a good notion on basic SQL, but I don't undestand to much of loopings, and I think that maybe is essential here.
What I need: a good example -- not exactly the answer -- to I understand if it is possible or not, or what I need to search (functions, keyworkds...) of MySQL to do.