I need a help to get data from a table which has id,serialnumber,process(prcs) and result
Try:

WITH cte AS ( SELECT id, 
                     serialnumber, 
                     prcs, 
                     result, 
                     ROW_NUMBER() OVER (PARTITION BY serialnumber 
                                        ORDER BY id DESC) rn
              FROM tblTest )
SELECT id, serialnumber, prcs, result
FROM cte
WHERE rn = 1
  AND result = 'FAIL'



  if lastprocess and 5th process fail, should show both


Try:

SELECT t1.*
FROM tblTest t1
WHERE t1.result = 'FAIL'
  AND NOT EXISTS ( SELECT 1
                   FROM tblTest t2
                   WHERE t1.serialnumber = t2.serialnumber 
                     AND t1.id &lt; t2.id
                     AND t2.result != 'FAIL' )