【数据库】SQL语句解析

学习网站:

http://www.runoob.com/sql/sql-having.html

1.

1.现在我们想要查找总访问量大于 200 的网站。

回取出多条重复的网址的SQL语句:

1 select 
2  a.url 
3 from websites a 
4 inner join access_log b
5 on a.id=b.site_id
6 where b.count>200 
只能取到不重复的网址的SQL语句:
1 select 
2  a.url 
3 from websites a 
4  where a.id in (select site_id from access_log b where b.count>200); 
原文地址:https://www.cnblogs.com/zhuzhubaoya/p/10427955.html