qq_25343655
代码是我快乐
2016-05-15 14:22
采纳率: 100%
浏览 1.3k
已采纳

关于SQL语句转换成linq语句

SELECT * FROM dbo.[USER] u,
(SELECT ua.User_Attention_Object_Id FROM dbo.User_Attention ua,dbo.[USER] u
WHERE u.User_Id=ua.User_Attention_User_Id AND ua.User_Attention_User_Id=3) uaid
WHERE u.User_Id=uaid.User_Attention_Object_Id

还望好心人帮我一下,感激不尽!!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • caozhy
    已采纳

    var uaid = from us in User_Attention
    select ua.User_Attention_Object_Id
    where u.User_Id==ua.User_Attention_User_Id && ua.User_Attention_User_Id==3;
    var query = from u in User
    WHERE u.User_Id==uaid.User_Attention_Object_Id
    select u;

    点赞 评论
  • caozhy

    也可以写在一起
    var query = from u in User
    let uaid = (from ua in User_Attention
    select ua.User_Attention_Object_Id
    where u.User_Id==ua.User_Attention_User_Id && ua.User_Attention_User_Id==3)
    WHERE u.User_Id==uaid.User_Attention_Object_Id
    select u;

    点赞 评论

相关推荐