关于几个比较经典的SQL语句
2005-06-07 15:24
441 查看
关于分组和表关联的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
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
相关文章推荐
- 觉得比较经典的几个SQL语句
- 几个常用T_SQL语句比较
- access和SqlServer 关于时间的SQL语句比较
- 几个关于数据库的sql语句
- ACCESS与MSSQL比较:SQL语句关于时间格式使用的注意点
- sql 语句关于时间的比较; 直接用大于小于就好了; 注意时间格式; 也可以直接比较到秒
- 关于拼sql语句执行与直接执行存储过程的效率比较
- 几个经典的sql语句
- 关于学生成绩查询的几个SQL语句
- oracle关于查询空间使用情况的几个sql语句
- SQL查询语句:关于时间的比较
- 【mybatis】mapper中SQL语句关于大小比较的转义
- 几个日期比较的SQL语句
- 关于“怎么比较两个SQL查询语句产生的结果集是否相同”搜集到的一些资料
- 关于拼sql语句执行与直接执行存储过程的效率比较
- 经典SQL语句大全
- 关于No Dialect mapping for JDBC type :-9 hibernate执行原生sql语句问题
- SQL语句经典大全(一)基础
- 经典SQL语句大全(1)
- access与SqlServer 之时间与日期及其它SQL语句比较