SELECT *
FROM `bskinpricktestfood`
WHERE `allergens` = 'Histamine'
AND `wheal1` = '0'
AND `wheal2` = '0'
AND `flare1` = '0'
AND `flare2` = '0'
AND `allergens` = 'Egg yolk'
AND `wheal1` = '0'
AND `wheal2` = '0'
AND `flare1` = '0'
AND `flare2` = '0'
SELECT *
FROM `bskinpricktestfood`
WHERE `allergens` = 'Histamine'
AND `wheal1` = '0'
AND `wheal2` = '0'
AND `flare1` = '0'
AND `flare2` = '0'
AND `allergens` = 'Egg yolk'
SELECT *
FROM `bskinpricktestfood`
WHERE
(`allergens` = 'Histamine' OR `allergens` = 'Egg yolk')
AND `wheal1` = '0'
AND `wheal2` = '0'
AND `flare1` = '0'
AND `flare2` = '0'
ครับ แต่ถ้าใช้ AND มันก็จะไม่ได้ตามเหตุผลที่ผมบอกครับ เก็ตหรือเปล่า
ถ้าอยากให้ได้ค่า HN ที่ไม่ซ้ำกัน ใช้ GROUP BY ครับ
Code (SQL)
SELECT `HN`
FROM `bskinpricktestfood`
WHERE
(`allergens` = 'Histamine' OR `allergens` = 'Egg yolk')
AND `wheal1` = '0'
AND `wheal2` = '0'
AND `flare1` = '0'
AND `flare2` = '0'
GROUP BY `HN`