简体   繁体   English

我需要帮助将 SQL 语句转换为 C# LINQ

[英]I need help to Convert a SQL Statement to C# LINQ

I need help with Converting this Select statement in LINQ C# Code我需要帮助在LINQ C#代码中转换此 Select 语句

SELECT TagName 
from Tags 
Where TagId IN(
    SELECT TagId 
    from PresentationTags 
    Where PresentationId = 2
)

Where() with nested Any() should do the job带有嵌套Any()Where() ) 应该可以完成这项工作

context.Tags.Where(
    x => context.PresentationTags.Any(
        y => y.PresentationId == 2 && x.TagId == y.TagId
    )
).Select(x => x.TagName);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM