处理 GroupBy 和 OrderBy DESC
2012-02-25 17:46
239 查看
处理 GroupBy 和 OrderBy DESC
#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Linq.dll";;
#r @"E:\Projects\F#3\FSharp.Data.TypeProviders.dll";;
open Microsoft.FSharp.Data.TypeProviders;;
open System.Linq;;
// Count() 在其中
[<Generate>]
type T0 = SqlDataConnection<"Data Source=.\SQLEXPRESS;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234">
let TypeProvider4() =
let db = T0.GetDataContext()
let q = query {
for s in db.Student do
groupBy s.Age into g
where ( g.Count() > 1 )
sortByDescending ( g.Count() )
select ( g.Key, g.Count() )
}
q |> Seq.iter (fun n -> printfn "%A" n)
q |> Seq.length
#r @"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Linq.dll";;
#r @"E:\Projects\F#3\FSharp.Data.TypeProviders.dll";;
open Microsoft.FSharp.Data.TypeProviders;;
open System.Linq;;
// Count() 在其中
[<Generate>]
type T0 = SqlDataConnection<"Data Source=.\SQLEXPRESS;Initial Catalog=FSharpSample;User ID=sa;Password=FSharpSample1234">
let TypeProvider4() =
let db = T0.GetDataContext()
let q = query {
for s in db.Student do
groupBy s.Age into g
where ( g.Count() > 1 )
sortByDescending ( g.Count() )
select ( g.Key, g.Count() )
}
q |> Seq.iter (fun n -> printfn "%A" n)
q |> Seq.length
相关文章推荐
- 扩展js对象数组的OrderByAsc和OrderByDesc方法实现思路
- SELECT TOP column FROM table [ORDER BY column [DESC]]
- Oracle order by 处理NULL值
- Oracle中row_number() over(partition by a order b asc,c desc)的应用
- Lamda OrderBy之后再GroupBy,排序没有作用.
- 步步为营VS 2008 + .NET 3.5(5) - LINQ查询操作符之Select、Where、OrderBy、OrderByDescending、GroupBy、Join、GroupJoin及其对应的查询语法
- row_number() over(partition by a order by b desc) rn 用法 收藏下
- OVER(PARTITION BY INQUIRY_ID, SID, PPID, TYPE ORDER BY EMAIL_ID DESC)
- row_number over(order by id desc)语句进行存储过程高效分页,百度分页(1,2,3,4,5....)
- 步步为营VS 2008 + .NET 3.5(5) - LINQ查询操作符之Select、Where、OrderBy、OrderByDescending、GroupBy、Join、GroupJoin及其对应的查询语法
- 扩展js对象数组的OrderByAsc和OrderByDesc方法
- ORDER BY TO_NUMBER(S.STOCK_CODE) 当S.STOCK_CODE不是数字字符串时会报错的处理
- row_number() over(partition by a order by b desc) rn
- 解决 联表查询 group by 之后 order by desc 不支持排序问题
- mysql:sql order by */* desc (查询)
- oracle sql 带order by ss desc 进行的分页注意事项
- oracle 分析函数:ROW_NUMBER() OVER(PARTITION BY ID ORDER BY VERSION DESC)
- LINQ查询操作符之Select、Where、OrderBy、OrderByDescending、GroupBy、Join、GroupJoin及其对应的查询语法
- sql2008 order by desc 查询速度慢
- row_number() over(partition by a order by b desc) rn 用法