แบบใช้ provis_labcode ครับ
SELECT q2.vstdate, q2.hn, q2.lab_order_result FROM
(SELECT q1.*
, @rnk := IF(@prevn = q1.hn, @rnk + 1, 1) AS rnk
, (@prevn := q1.hn) AS prevn
FROM(SELECT v.vstdate,h.hn,o.lab_order_result,i.provis_labcode
FROM ovst AS v
INNER JOIN lab_head AS h ON v.vn = h.vn
INNER JOIN lab_order AS o ON h.lab_order_number = o.lab_order_number
INNER JOIN lab_items AS i ON o.lab_items_code = i.lab_items_code
, (SELECT @prevn := "", @rnk := 0) AS var1
WHERE i.provis_labcode = "0531601" AND
v.vstdate BETWEEN "2017-10-01" AND "2018-09-30"
ORDER BY v.hn ASC, v.vstdate DESC) AS q1) AS q2
WHERE q2.rnk = 1