问题描述
- 关于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还望好心人帮我一下,感激不尽!!
解决方案
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;
解决方案二:
也可以写在一起
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;
解决方案三:
linq 调试转换成sql语句
dbf转换成表的SQL语句
时间: 2024-12-03 21:38:44