c# - How can I convert this SQL to LINQ -
i've created code-first database , question i'm having difficulty transcribing sql statement c# code.
below there's sql statement require on adapting , tables use. objective of sql query on table tableviewedmessagelog record of user saw message , desired effect select messages non-read (which information stored on table -- tableviewmessagelogs) user.
http://gyazo.com/0105c0959bdd2930272bf5c07a112a11
select * tablemessages tm tm.id not in (select tv.message_id tableviewedmessagelogs tv tv.user_email = 'asd@asd')
try this:
var data = (from e in context.tablemessages context.tableviewedmessagelogs .where(x => x.user_email == 'asd@asd') .select(x => x.message_id).contains(e.id) == false select e) .tolist();
Comments
Post a Comment