我如何将其更改为linq to sql?
select * from ratesSchedule as rs inner join userdetails as ud on rs.sid = ud.sid and rs.tabletype = 'd'
我到目前为止
var results = from rs in db.ratesSchedule join ud in db.userdetails on rs.sid equals ud.sid
但我无法弄清楚如何添加"和rs.tabletype ='d'"
如果你想在没有where子句的情况下这样做,试试这个:
var results = from rs in db.ratesSchedule join ud in db.userdetails on new { rs.sid, rs.tabletype } equals new { ud.sid, tabletype = "d" }
我个人在这种情况下坚持使用SQL,因为LINQ甚至不容易阅读.;)