Reputation: 15138
I want to compare a table column with the last entry of another (by foreign key given) table. And then fobit the entry, when it's the last.
So:
Should be: NO
So:
Should be: YES
My try:
(from a in dc.table1
where a.UserID != a.table2.Last().UserID)
But it don't work.
Error is
The query operator 'Last' is not supported.
Upvotes: 0
Views: 91
Reputation: 838376
Last on a database query doesn't make sense unless you also have an order by:
a.table2.OrderBy(x => x.id).Last()
It might also perform better if you order by descending and use First instead, although I haven't tested it.
Upvotes: 1