Could somebody assist me in converting a sql query into LINQ, i’m pretty handy with linq but this is a bit much and i can’t download linqpad here!
select
t.*,
l.*
from
email_templates t
left join
(select
id as email_id,
sent_at,
sent_by
from
email_log
where
id = (select max(id)
from email_log
where as_at_date = '20100618'
group by template_id )
)l
on t.id = v.template_id
By the way I understand your query; you need something like this…
… LINQ is composable so you can break your query into manageable parts. Breaking your query into smaller parts will make it much easier to understand. You can also return complex objects instead of creating flat record rendering from your database.