求一条sql语句

ccgrjxx597 2013-05-22 03:13:57
现有2张表
-PCHOME_GOODS_INFO 商品信息表
--PCHOME_GOODS_INFO.ID IS '系统ID字段(商品ID)' ;
--PCHOME_GOODS_INFO.GOODS_ID IS 'Pchome定义的商品ID' ;
--PCHOME_GOODS_INFO.GOODS_NAME IS '商品名称' ;
--PCHOME_GOODS_INFO.GOODS_PRICE IS '商品价格(2499)' ;
--PCHOME_GOODS_INFO.GOODS_SUBCATE IS '商品自类别' ;
-- 手机:236,数码相机:103,平板电脑: 635,液晶电视:170,笔记本电脑:60
--PCHOME_GOODS_INFO.GOODS_NO IS '所属编号' ;
--PCHOME_GOODS_INFO.GOODS_TYPE_NAME IS '商品自类别名称' ;
--PCHOME_GOODS_INFO.GOODS_FORMAT_PRICE IS '有币种符号的商品价格' ;
--PCHOME_GOODS_INFO.GOODS_REG_DATE IS '添加时间(接口提供)' ;
--PCHOME_GOODS_INFO.GOODS_BRIEF IS '简评' ;
--PCHOME_GOODS_INFO.GOODS_BIG_PIC IS '大图片' ;
--PCHOME_GOODS_INFO.GOODS_MID_PIC IS '中图片' ;
--PCHOME_GOODS_INFO.GOODS_SMALL_PIC IS '小图片' ;
--PCHOME_GOODS_INFO.GOODS_SMALL_TITTLE_PIC IS '小标题图片' ;
--PCHOME_GOODS_INFO.GOODS_SD_SMALL_TITTLE_PIC IS '标清小标题图片' ;
--PCHOME_GOODS_INFO.GOODS_TITTLE_PIC IS '高清标题图片' ;
--PCHOME_GOODS_INFO.GOODS_SD_TITTLE_PIC IS '标清标题图片' ;
--PCHOME_GOODS_INFO.GOODS_UPDATE_TIME IS '更新时间' ;
--PCHOME_GOODS_INFO.GOODS_TYPE IS '排行信息(0:新品 1:热门)';
--PCHOME_GOODS_INFO.GOODS_ORDERBY IS '商品排序' ;
--PCHOME_GOODS_INFO.GOODS_CHECKED IS '商品是否审核(1:未审核 2:已审核)' ;

=================================================================================
--PCHOME_PICTURE 样张图评数据表
--PCHOME_PICTURE.ID '系统ID字段'
--PCHOME_PICTURE.PCHOME_GOODS_INFO_ID '商品信息表中的商品ID'
--PCHOME_PICTURE.PCHOME_EVALUATION_ID '商品图评表中的图评ID,样张数据此字段为空'
--PCHOME_PICTURE.PIC_PATH '图片路径(只存储一张图片)'
--PCHOME_PICTURE.SDPIC_PATH '标清图片路径(只存储一张图片 400 * 300)'
--PCHOME_PICTURE.THUMBNAIL_PIC '缩略图地址(只存储一张图片 280 * 210)图评数据此字段为空'
--PCHOME_PICTURE.PIC_TYPE '图片类型(1:图评图片 2:样张图片)'
--PCHOME_PICTURE.CHECK_FLAG '审核标志(0:未审核 1审核通过 2审核不通过)'

=========================================================================
要求取出PCHOME_GOODS_INFO表数码相机数据记录,按照(PCHOME_PICTURE的PCHOME_GOODS_INFO_ID字段分组之后)统计的结果降序排序。最好带分页(int start,int end)。
PCHOME_GOODS_INFO.ID 对应PCHOME_PICTURE.PCHOME_GOODS_INFO_ID。

目的是为了,将样张数量为0的商品排在后面。
...全文
180 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
ccgrjxx597 2013-08-10
分给你吧,救你回答了
回复
anan870622 2013-05-25
能否把格式整理好再来提问
回复
restbely 2013-05-23
SELECT T1.ID, COUNT(1) FROM PCHOME_GOODS_INFO T1 INNER JOIN PCHOME_PICTURE T2 ON T1.ID = T2.PCHOME_GOODS_INFO_ID WHERE T1.GOODS_SUBCATE = '103' GROUP BY T2.PCHOME_GOODS_INFO_ID ORDER BY COUNT(1) DESC
回复
rabitsky 2013-05-22
格式太乱了,看着头疼
回复
相关推荐
发帖
Oracle
创建于2007-09-28

1.6w+

社区成员

Oracle开发相关技术讨论
申请成为版主
帖子事件
创建了帖子
2013-05-22 03:13
社区公告
暂无公告