SELECT visitdiag.* ,cdisease.diseasenamethai,visit.visitdate
from
visitdiag
INNER JOIN cdisease on visitdiag.diagcode=cdisease.diseasecode
INNER JOIN visit on visitdiag.pcucode=visit.pcucode and visitdiag.visitno=visit.visitno
WHERE DIAGCODE in ('J06.9','D22.9','L02.9','L03.9','T07','Z34.9')
or DIAGCODE BETWEEN 'T14.0' and 'T14.9'
ORDER BY visit.visitdate DESC;