var t = ( from t in things where t.id = lookupID select
t.id).FirstOrDefault();

Because I prefer the SQL syntax.

 

Ooops I'm awake and back at the screen. Thanks, at 10pm last night I didn't
think of "inverting" the query. I do get 0 instead of (int?)null as a
default in this case, but that's actually convenient for my particular case.

 

I was afraid that sticking this sub-query into an EF4 query of a SQLite
database might penalise performance, but it makes no difference. I suppose
the Db engine turns it into an efficient join.

 

Greg

 

Reply via email to