鍍金池/ 問答/數(shù)據(jù)庫/ 篩選數(shù)據(jù)sql

篩選數(shù)據(jù)sql

圖片描述

望大神給個詳細(xì)點(diǎn)的過程

回答
編輯回答
夏夕

為啥要在sql里面做這么多的邏輯處理,查出結(jié)果再對數(shù)據(jù)處理的方式比較好吧,也不必依靠id和日期的對應(yīng)關(guān)系

2017年11月11日 13:13
編輯回答
夢囈

請參考這個問題。

2017年11月28日 21:58
編輯回答
六扇門
select * 
from 
    tourists
where 
    find_in_set(id,
    (select group_concat(id_3) gid 
     from 
        (select group_concat(id) id_all from tourists where visits>=100) a,
        (select concat(id,",",id+1,",",id+2) id_3 from tourists where visits>=100) b
     where locate(id_3,id_all)>0
    ));
2017年11月11日 09:07