select p.*
from tbplayer p
inner join tbhealth h on h.id_Hd = p.id_Pla AND h.r1500=0 AND r800=0 AND r200=0 AND fitness=0
where month(h.Date_Health) = month(ค้นหาเดือน) AND year(h.Date_Healt) = year(ค้นหาปี)
SELECT tbplayer.Id_Pla, tbplayer.Name_Pla, tbhealth.Date_Health, tbhealth.Id_Pla, tbplayer.Position_Pla
FROM tbplayer
LEFT JOIN tbhealth ON tbplayer.Id_Pla = tbhealth.Id_Pla
AND DATE_FORMAT( tbhealth.Date_Health, '%Y-%m' ) = '2014-02'
ORDER BY `tbplayer`.`Id_Pla` ASC
SELECT tbplayer.Id_Pla, tbplayer.Name_Pla, tbhealth.Date_Health, tbhealth.Id_Pla, tbplayer.Position_Pla FROM tbplayer LEFT JOIN tbhealth ON tbplayer.Id_Pla = tbhealth.Id_Pla WHERE DATE_FORMAT( tbhealth.Date_Health, '%Y-%m' ) = '2014-02' AND tbhealth.Id_Pla IS NULL ORDER BY `tbplayer`.`Id_Pla` ASC
SELECT tbplayer.Id_Pla, tbplayer.Name_Pla, tbplayer.Position_Pla FROM tbplayer LEFT JOIN tbhealth ON tbplayer.Id_Pla = tbhealth.Id_Pla AND DATE_FORMAT( tbhealth.Date_Health, '%Y-%m' ) = '2014-02' WHERE tbhealth.Id_Pla IS NULL ORDER BY `tbplayer`.`Id_Pla` ASC
ได้แล้วครับ
SELECT tbplayer.Id_Pla, tbplayer.Name_Pla, tbhealth.Date_Health, tbhealth.Id_Pla, tbplayer.Position_Pla
FROM tbplayer
LEFT JOIN tbhealth ON tbplayer.Id_Pla = tbhealth.Id_Pla
AND DATE_FORMAT( tbhealth.Date_Health, '%Y-%m' ) = '2014-02'
WHERE tbhealth.Date_Health IS NULL
AND tbhealth.Id_Pla IS NULL
ORDER BY `tbplayer`.`Id_Pla` ASC