You can use comditional aggregation as follows:
SELECT user, id,
Timediff( Max(case when status='OUT' then time end),
Min(case when status='IN' then time end) ) as diff
FROM table
WHERE DATE(date) BETWEEN '2021-02-01' AND '2021-02-02'
Group by user, id;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…