Query:
select machinename, StatusCode, max(size) as size, statusID
from machine where MachineID In( '33','22') and StatusCode = 166
group by machinename, StatusCode, statusID
order by max(size) DESC
Result:
machinename StatusCode size statusID
----------- ---------- ---- --------
test1 166 50 1
test1 166 25 2
test2 166 75 3
test2 166 48 4
Requirement:
I need to display only one entry for each machine.
I have to do this by taking the max size value between the two entries as shown above.
like for test1 i have two sizes 50 and 25 I have to show the row which has 50 and ignore row which has 25.
Thanks
Desired Result:
machinename StatusCode size statusID
----------- ---------- ---- --------
test1 166 50 1
test2 166 75 3
1 Answer