Hi @pawa19961996 ,
Please find below query in your case which will find the max duration.
MATCH(g:task)
WITH g.WAFERID AS ID, collect(m.duration) AS duration
UNWIND duration AS val
RETURN ID, max(val) as max_duration
Please let me know if any other help required.