1 简单查询
SELECT * FROM table1 LIMIT 3;
SELECT * FROM table1 ORDER BY citycode;
2 Join
SELECT SUM(table1.pv) FROM table1 JOIN table2 WHERE table1.siteid = table2.siteid;
select table1.siteid, sum(table1.pv) from table1 join table2 where table1.siteid = table2.siteid group by table1.siteid;
3 子查询
SELECT SUM(pv) FROM table2 WHERE siteid IN (SELECT siteid FROM table1 WHERE siteid > 1);