关于几个比较经典的SQL语句

关于分组和表关联的SQL语句:
select distinct cameraman.cid,cameraman.username as username,count(*as count from c_images left join cameraman on c_images.cid=cameraman.cid where cameraman.cid=1 group by username

多表关联:
select menu.parent_id,image_group.group_id,image_group.menu_id,image_group.group_name,image_group.remark,images.iid,images.extname,images.name from image_group inner join menu on image_group.menu_id=menu.menu_id left join images on image_group.group_id=images.gid where image_group.menu_id=5 and images.iflabel=1
原文地址:https://www.cnblogs.com/songafeng/p/169495.html