c# - Rewrite sql sub to linq query -
i'm not sure begin on how convert query linq.
started reading here , looked few youtube videos not sure
here query:
select o.replacementitemid, o.itemstatus, o.description, i.itemwarrantyid, o.id originalitemid ( select id, itemstatus, description, itemwarrantyid, replacementitemid item itemstatus = 'obso' )o inner join item on o.replacementitemid = i.id
christos provided method chaining example, here's query syntax example:
var results = o in (from x in item x.itemstatus == "obso" select new { x.id, x.itemstatus, x.description, x.itemwarrantyid, x.replacementitemid }) join in item on o.replacementitemid equals i.itemid select new { o.replacementitemid, o.itemstatus, o.description, i.itemwarrantyid, originalitemid = o.id };
i'm partial query syntax weird stuff this, because it's typically easier read. :)
Comments
Post a Comment