Lambda中的SQL到LINQ查询 [英] SQL to LINQ query in Lambda
问题描述
有人可以帮我将以下查询转换为LINQ。
我在这里和那里尝试了几个选项,但没有真正有效。
查询: -
从表tb1中选择*,(SELECT column1,column2,max(column3)as column3 FROM Table1 Group by Column1,Column2)tmp where tb1.column3 = tmp.column3 order by tb1.column3 desc
说明: -
1. Groupby Column1,Column2
2.第3列的最大值 - Aggregade
3. OrderbyDecending - column3
4.从表中选择所有列。
谢谢,
编码器
Can some one help me to convert following query into LINQ.
I Tried several options here and there but nothing really worked.
Query:-
Select * from Table tb1,(SELECT column1 ,column2,max(column3) as column3 FROM Table1 Group by Column1,Column2) tmp where tb1.column3 = tmp.column3 Order by tb1.column3 desc
Explanation:-
1. Groupby Column1,Column2
2. Max of column3 -- Aggregade
3. OrderbyDecending -- column3
4. Selecting all the columns from table.
Thanks,
Coder
推荐答案
为此您可以使用< b> Linqer。
Linqer是一个SQL to LINQ转换工具。它有助于学习LINQ并转换现有的SQL语句。
并非每个SQL语句都可以转换为LINQ,但Linqer涵盖了许多不同类型的SQL表达式。 Linqer支持.NET语言 - C#和Visual Basic。
因为LINQ是C#和VB语言的一部分,所以它对数据类型转换很敏感。 Linqer在生成的LINQ语句中执行所需的类型转换。
有关详细信息,请查看:
Linqer
我希望这会有所帮助给你。
For that you can use Linqer.
Linqer is a SQL to LINQ conversion tool. It helps learning LINQ and convert existing SQL statements.
Not every SQL statement can be converted to LINQ, but Linqer covers many different types of SQL expressions. Linqer supports both .NET languages - C# and Visual Basic.
Because LINQ is a part of the C# and VB languages, it is sensitive to data type conversion. Linqer performs required type castings in the produced LINQ statements.
For more info check this:
Linqer
I hope this will help to you.
这篇关于Lambda中的SQL到LINQ查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!