您的位置:首页 > 数据库

经典的,统计SQL语句

2014-07-01 09:11 351 查看
 SELECT a.id as aid,a.name,b.id as bid,b.visits,b.title,b.out_member_id,b.time,b.edit_time,b.visits,b.is_delete,cm.scount FROM sns_member_type as a ,sns_member_log as b left join (select out_id,count(*) as scount from sns_member_review where 1 group by out_id) as cm on b.id=cm.out_id WHERE b.out_class_id=a.id and b.out_member_id=134 and a.parent_id=1 and b.out_class_id<>8 and b.out_class_id<>9 and b.out_class_id<>10 and b.out_class_id<>11 and b.is_delete="n" ORDER BY b.time desc LIMIT 0, 10;

 

3表联合查询+统计
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: