作者evilove (愿意感动就是一种享受)
看板Database
标题[SQL ] 请问这两个语法结果一样吗?
时间Fri Jun 17 11:12:59 2016
资料库名称: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://webptt.com/cn.aspx?n=bbs/Database/M.1466133181.A.24E.html
1F:→ Ammenze: 应该是一样的 06/17 12:19
2F:→ evilove: 谢谢您~ 06/17 23:16