1. 程式人生 > >mysql查詢用法

mysql查詢用法

一.對於某個分組查詢加條件用having
SELECT Websites.name, SUM(access_log.count) AS nums FROM Websites

INNER JOIN access_log
ON Websites.id=access_log.site_id
WHERE Websites.alexa < 200 
GROUP BY Websites.name
HAVING SUM(access_log.count) > 200;