0

如何在 linq (VB) 中编写此查询

select 
    g.* 
from PROB_GROUP g 
inner join 
(
    select 
        PGR_NAME, 
        PGR_PCELL, 
        max(PGR_VERSION) max_version 
    from PROB_GROUP 
    group by PGR_NAME, PGR_PCELL
) grouped_g 
on g.PGR_NAME = grouped_g.PGR_NAME 
    and g.PGR_PCELL = grouped_g.PGR_PCELL 
    and g.PGR_VERSION = grouped_g.max_version 
order by g.PGR_TYPE, g.PGR_NAME
4

1 回答 1

0

知道了

From pp In DB.PROB_GROUPs Join p1 In
 (From p In DB.PROB_GROUPs Group By p.PGR_NAME, p.PGR_PCELL Into g = Group Select PGR_NAME, PGR_PCELL, H_VERSION = g.Max(Function(p) p.PGR_VERSION))
 On p1.H_VERSION Equals pp.PGR_VERSION And p1.PGR_NAME Equals pp.PGR_NAME And p1.PGR_PCELL Equals pp.PGR_PCELL Select pp Order By pp.PGR_TYPE, pp.PGR_NAME

应该没问题吧?

于 2012-09-27T10:37:36.753 回答