标签:
1、多表查询(左连接)
SELECT a.*,b.*,b.id AS reid,c.*,c.id AS prid FROM `1008_user` a LEFT JOIN `1008_reward` b ON a.id = b.uid LEFT JOIN `1008_prize` c ON c.id = b.rid #外左连结
2、夺标查询
SELECT us.*,re.*,re.id AS reid FROM `1008_reward` AS re,`1008_user` AS us WHERE re.uid = us.id #内连结
3关键词
select *,sum(pnum) as num from `1008_demo` group by pid order by num ASC|DESC
标签:
原文地址:http://www.cnblogs.com/finnlee/p/5108701.html