Getting related tags from SQL Server when you have filtered down

前端 未结 3 1863
春和景丽
春和景丽 2021-02-06 18:47

I asked this question before and got a great working answer.

what is the query to get "related tags" like in stack overflow

but i realized that SOF ac

3条回答
  •  别跟我提以往
    2021-02-06 19:10

     SELECT t.tagName
     FROM tags t INNER JOIN tagsBridge tb on t.id=tb.tagID
    
     where tb.linkID in (
    
       select tb.linkID from tagsBridge tb
       where tb.tagID= @first_tag
    
       intersect
    
       select tb.linkID from tagsBridge tb
       where tb.tagID= @second_tag
    
       intersect
    
       select tb.linkID from tagsBridge tb
       where tb.tagID= @third_tag
    
       intersect
    
       select tb.linkID from tagsBridge tb
       where tb.tagID= @fourth_tag
    
       --- // you can continue
     )
    
    )
    

提交回复
热议问题