同一條件下符合不通條件的數據sql查詢

select * from user_tag a where `code`='LJ_002' and is_deleted =0 and  
'LJ_001' not in (select code from user_tag where id <> a.id and user_id = a.user_id and is_deleted =0)

select * from user_tag a where type='LJ_002' and  'LJ_001'=(select code from user_tagwhere id>a.id order by id limit 1)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章