Erm, maybe that SQL statement is confusing, simplify that SQL statement first such that LINQ to SQL can recognise.

Whenever i see "value = MAX(value)", reminds me of the cookie/chocolate chip solution in chapter 4 still fresh on my mind altho thats for Linq to Object

The objective is clear.

U have a Box of Cookies (diekenMerken) ,

there's cookies (DKMLD) of different shape (GDRID) ,

every cookies have chocolate chips (DKMTIJDSTIP).

U want to ignore all shapes except Square and find the cookies with the most chocolate chips

**among the Squared Cookies**
SELECT A.DKMLD

from DiekenMerken A INNER JOIN

(

SELECT MAX(DKMTIJDSTIP) as MAXNUMBER, GDRLD

from DIEKENMERKEN

Group By GDRLD

) B

on A.GDRLD = B.GDRLD and A.dkmtijdstip = B.maxnumber

where A.GDRLD = 'SQUARE'

Now convert this to LINQ...

not sure if the below helps the efficiency.

SELECT A.DKMLD

from DiekenMerken A INNER JOIN

(

SELECT MAX(DKMTIJDSTIP) as MAXNUMBER, GDRLD

from DIEKENMERKEN

**where A.GDRLD = 'SQUARE'**
Group By GDRLD

) B

on A.GDRLD = B.GDRLD and A.dkmtijdstip = B.maxnumber

/* OR */

SELECT A.DKMLD

from DiekenMerken A INNER JOIN

(

SELECT MAX(DKMTIJDSTIP) as MAXNUMBER

from DIEKENMERKEN

**where A.GDRLD = 'SQUARE'**
) B

on A.dkmtijdstip = B.maxnumber

where

**A.GDRLD = 'SQUARE'**