I've been for a while trying to do using Linq and lambda expressions a query that I did already in SQL, but there is something that I'm missing...
This is the SQL query:
select o.ord_no from orders o where 1 <=
(select count(*) from orders where orders.purch_amt < o.purch_amt
and orders.ord_date = '2012-02-14')
var date = DateTime.ParseExact("20120214", "yyyyMMdd", CultureInfo.InvariantCulture); var result = dbContext.orders .Where(q => dbContext.orders .Where(s => s.purch_amt < q.purch_amt) .Where(s => s.ord_date == date).Count() > 0) .ToList()