代码之家  ›  专栏  ›  技术社区  ›  Phil

在LINQ to SQL中,如何确定哪些列元素是另一列的子集(即Like SQL语句)

  •  0
  • Phil  · 技术社区  · 17 年前

    以下是一些代码:

    //all possible search terms of interest 
    searchTerms = from s in dc.SearchTerms
                  select s.term;
    
    //all possible  results  
    var results = from r in dc.Data
                  select r.hyperlinks;
    

    2 回复  |  直到 17 年前
        1
  •  2
  •   Bruno Reis    17 年前

    var results = from r in dc.Data
                  where searchTerms.Any(x => r.hyperlinks.Contains(x))
                  select r.hyperlinks;
    

    这就是全部!

    boolean .

        2
  •  0
  •   Amy B    17 年前

    var results =
        from r in dc.Data
        where dc.SearchTerms.Any(s => r.hyperlinks.Contains(s.Term))
        select r.hyperlinks;