I have the following code which only pulls results from mySqlDataTableB if the SiteUserID exists in mySqlDataTableA.
Otherwise, if the SiteUserID doesn't exist in the mySqlDataTableA, then the result for the "Data" field is always 0 even if there is a different value in mySqlDataTableB.
How can I change it so that it will take the value from mySqlDataTableB even if that SiteUserID doesn't exists in mySqlDataTableA?
var mySqlResult = from mySqlDataRows in mySqlDataTableA.AsEnumerable()
join mySqlDataRows2 in mySqlDataTableB.AsEnumerable()
on Convert.ToInt32(mySqlDataRows.Field<string>("SiteUserID")) equals
Convert.ToInt32(mySqlDataRows2.Field<string>("SiteUserID")) into lj
from r in lj.DefaultIfEmpty()
select new object[]
{
mySqlDataRows.Field<string>("SiteUserID"),
mySqlDataRows.Field<long>("Posts"),
r?.Field<long>("Data") ?? 0
};