Lamda Expression(LINQ) [英] Lamda Expression (LINQ)
本文介绍了Lamda Expression(LINQ)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Select * from Temp
----------------------
这在数据库中
----------------------
this is in database
---------------------------------------------
PlateName PlateType Qty Cost Rate Machine
---------------------------------------------
P.S Medium 4 1600.00 400.00 SM101
P.S Short 4 1600.00 400.00 SM101
P.S Short 4 1600.00 400.00 SM101
P.S Short 4 1600.00 400.00 SM101
P.S Short 4 1600.00 400.00 SM101
P.S Short 4 1600.00 400.00 SM101
CTP Short 4 1200.00 300.00 SM101
CTP Short 4 1200.00 300.00 SM101
CTP Short 4 1200.00 300.00 SM101
CTP Short 4 1200.00 300.00 SM101
CTP Short 4 1200.00 300.00 SM101
---------------------------------------------
SELECT PlateName, PlateType, sum(Qty) Qty, sum(Cost) Cost, Rate, Machine
FROM TempPlates WHERE PlateType='short' and PlateName='P.S'
GROUP BY Rate,Machine,PlateType,PlateName
结果是Query is
Result of this is Query is
PlateName PlateType Qty Cost Rate Machine
-------------------------------------------------
P.S Short 20 8000.00 400.00 SM101
-------------------------------------------------
我需要将此Querry转换为Lamda Expression(LINQ)以获得相同的结果
在此先感谢... !!
I need to convert this querry into Lamda Expression(LINQ) for same result
thank in advance...!!
推荐答案
您无需将其转换为Lamda表达式.您需要一个LINQ查询.请学习区别.
这里有很多示例 LINQ查询示例 [
You don''t need to convert this to a Lamda Expression. You need a LINQ query. Please learn to difference.
There are plenty of examples here LINQ Query Samples[^]
^ ]有很多例子也一样.
LINQPad[^] has a lot of examples too.
这篇关于Lamda Expression(LINQ)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文