-1

如何将此查询从 MySQL 转换为 LINQ?

SELECT SUM(IF(x>0, c*(x/100),20.00)) AS x1 
FROM tablename 
WHERE uid="some value" AND name='some value';
4

2 回答 2

2
var sum =
    testlist.Where(item => item.name == "somevalue" && item.uid == "somevalue")
    .Sum(c => c.x > 0 ? c.c*(c.x/100) : 20);

尝试这个

于 2012-10-04T08:12:55.207 回答
0

试试这个工具。

http://softwaretopic.informer.com/sql-to-linq-converter-online-free/

于 2012-10-04T08:14:52.453 回答