[SQL ] 請問這兩個語法結果一樣嗎?
資料庫名稱:MySQL
內容/問題描述:您好我是初學者,想知道下面兩個語法的結果是一樣的嗎?
謝謝!
SELECT COUNT(DISTINCT pid) AS Hispanic
FROM (SELECT patients.pid, patients.ethnicity, ethnicity.Name, ethnicity.Code
FROM ethnicity
INNER JOIN patients
ON patients.ethnicity=ethnicity.Code)
WHERE Name='Hispanic or Latino';
SELECT COUNT(DISTINCT patients.pid) AS Hispanic
FROM ethnicity, patients
WHERE patients.ethnicity=ethnicity.Code
AND ethnicity.Name='Hispanic or Latino';
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 69.143.188.208
※ 文章網址: https://www.ptt.cc/bbs/Database/M.1466133181.A.24E.html
→
06/17 12:19, , 1F
06/17 12:19, 1F
→
06/17 23:16, , 2F
06/17 23:16, 2F
Database 近期熱門文章
PTT數位生活區 即時熱門文章