[Solved] SQL Linq syntax [closed]


One way would be like this:

db.polls.Where(p => p.id == polls.Where(x => x.publish_at == polls.Max(y => y.publish_at)).Max(x => x.id));

Another way like this:

from p in db.polls
where p.id == (from x in db.polls
               where x.id == (from y in db.polls
                              where y.publish_at == db.polls.Max(y => y.publish_at)
                              select y.id).Max())
               select x.id).Max())
select p;

1

solved SQL Linq syntax [closed]