sql - Overlapping times -
i have table this:
id, timestart, timefinished
i need find timestart
begins prior timefinished
, has higher id
, means overlapping time.
id timestart timefinished 1 2014-01-01 2014-01-02 2 2014-01-02 2014-01-03 3 2014-01-02 2014-01-04
this found in row 3. here timestart < timefinished
in row 2. (or find row 2 timefinished > timestart
in row 3)
try left outer join :
select t1.* table t1 left join table t2 on t1.id > t2.id , t1.timestart < t2.timefinished t2.id not null
Comments
Post a Comment