如何将此查询从MySQL转换为LINQ?
SELECT SUM(IF(x>0, c*(x/100),20.00)) AS x1
FROM tablename
WHERE uid="some value" AND name='some value';
答案 0 :(得分:2)
var sum =
testlist.Where(item => item.name == "somevalue" && item.uid == "somevalue")
.Sum(c => c.x > 0 ? c.c*(c.x/100) : 20);
试试这个
答案 1 :(得分:0)