I have a table with records that have 8 integer values:
TableChild:
Parent Name int1 int2 int3 int4 int5 int6 int7 int8
a w 1 3 2 0 1 3 4 3
a x 4 5 2 5 3 2 4 6
b y 5 3 5 3 1 1 3 4
b z 4 1 2 4 2 2 4 2
I need to find the maximum value for ‘x’ for example.
I also (separately) need to get the highest value in the whole table for parent ‘a’ for example.
var query = from row in TableChild
where row.Name == x
select new
{
Parent = row.Parent,
Name = row.Name,
status = GetHighestValueOfRowInTableChild,
...
};
returns { (a,x,6) }
var queryParent = from row in tableParent
where row.Name == a
select new
{
Parent = row.Name,
status = GetHighestValueOfAllChildItemsInTableChild,
...
};
returns { (a,6) }
I have played around with .Max() and attempted using expressions, but haven’t had any luck as I should probably be using multiple joins but can’t figure out how they should interact.
Make an array with the values of int{X} properties, an later get the max value of the array