ยกตัวอย่างได้ไหมครับจากโค้ดดังนี้
SELECT pr.provname, o.offid, o.offname, p.cid, p.prename, p.firstname, p.lastname, p.birthdate, n.9qscore, n.visitdate, e.8qscore, e.visitdate, p.chroniccode, p.r1, p.r2, p.r3, p.r4, p.r5
FROM `depres_person` p
INNER JOIN depres_office o ON p.offid = o.offid
INNER JOIN depres_province pr ON o.provid = pr.provid
INNER JOIN depres_person_9q n ON p.cid = n.cid
LEFT OUTER JOIN depres_person_8q e ON n.cid = e.cid
WHERE LENGTH( p.cid ) = 13
AND n.9qscore >=7
AND e.8qscore IS NOT NULL
AND DATE_FORMAT(NOW(), '%Y') - DATE_FORMAT(birthdate, '%Y') - (DATE_FORMAT(NOW(), '00-%m-%d') < DATE_FORMAT(birthdate, '00-%m-%d')) >= 60
AND n.visitdate between '2010-10-01' and NOW ()
AND (NOT chroniccode IS NULL and chroniccode != "" and chroniccode != "0")
OR (NOT r1 IS NULL and r1 != "" and r1 != "0")
OR (NOT r2 IS NULL and r2 != "" and r2 != "0")
OR (NOT r3 IS NULL and r3 != "" and r3 != "0")
OR (NOT r4 IS NULL and r4 != "" and r4 != "0")
OR (NOT r5 IS NULL and r5 != "" and r5 != "0")
GROUP BY p.cid
Date :
2011-05-23 17:37:42
By :
555
No. 3
Guest
FUNCTION depression_210354.NOW does not exist
ลองดูแล้วแบบนี้หมายความว่าไงครับ