I've got two queries which I union together in Linq like so;
var reWorkData = from a in db.IV30300s
join b in db.IV00101s on a.ITEMNMBR equals b.ITEMNMBR into t1
from b1 in t1.DefaultIfEmpty()
join c in db.IV30200s on a.DOCTYPE equals c.IVDOCTYP into t2
from c1 in t2.Where(c => a.DOCNUMBR == c.DOCNUMBR).DefaultIfEmpty()
where a.TRXLOCTN.ToUpper() == "QA" &&
a.DOCTYPE == 1 &&
(a.DOCDATE >= start && a.DOCDATE <= end) &&
a.TRXQTY > 0
select new { A = a, B = b1 };
var newBuildData = from a in db.IV30300s
join b in db.IV00101s on a.ITEMNMBR equals b.ITEMNMBR into t1
from b1 in t1.DefaultIfEmpty()
join c in db.IV30200s on a.DOCTYPE equals c.IVDOCTYP into t2
from c1 in t2.Where(c => a.DOCNUMBR == c.DOCNUMBR).DefaultIfEmpty()
where a.TRXLOCTN.ToUpper() == "PRODUCTION" &&
a.TRNSTLOC.ToUpper() == "QA" &&
a.DOCTYPE == 3 &&
(a.DOCDATE >= start && a.DOCDATE <= end) &&
a.TRXQTY > 0
select new { A = a, B = b1 };
var rawData = reWorkData.Union(newBuildData);
What I then need to do is perform a piece of logic checking on a.ITEMNMBR and change it's value depending on the outcome. This will then be used to group items together.
IS it simply a case of iterating through something, performing the logic and then making the change?