匹配多个单词,选择与多个单词匹配的单词

  • 本文关键字:单词 单词匹 选择 sql
  • 更新时间 :
  • 英文 :


我有两个表,第一个表看起来像

键1 字1
键1 word2
键1 word3
键2 word4
键2 word5
键3 word6

这应该会执行得更好工作示例在这里

select t1_key,t2_key,combined,count(t1_key) from (
select aggr.t1_key ,aggr.t2_key ,(select STRING_AGG(value,' ') from table2 where t2_key = aggr.t2_key ) as combined from 
(select t1_key,t2_key from table1 left join table2 on table1.value = table2.value ) as aggr ) as whole 
group by t1_key,t2_key,combined 

相关内容

最新更新