Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a recordset rsTaxType and i want to group by a field V_TAX_TYPE_MCD to get the max(D_EFFECTIVE_DATE) in each group .

I have the below query which gives error in line 'Group grc By grc.V_TAX_TYPE_MCD Into Group' saying -
"range variable name can be inferred only from a simple or qualified name with no arguments ".

Can somebody help me in fixing the query ?
VB
Dim grcOrders As DataTable = rsTaxType.DataSet.Tables(0)
Dim query = From grc In grcOrders.AsEnumerable() _
   Group grc By grc.V_TAX_TYPE_MCD Into Group _
   Select V_TAX_TYPE_MCD, maxdate = Group.Max(Function(grc) grc.D_EFFECTIVE_DATE
Posted
Updated 4-Nov-11 0:11am
v2

1 solution

Try this
SQL
From grc In grcOrders.AsEnumerable() _
   Group By grc.V_TAX_TYPE_MCD Into maxdate = Max(grc.D_EFFECTIVE_DATE) _
   Select V_TAX_TYPE_MCD,  maxdate 
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900