insert into product_relate
select distinct '006013' prodid,count(prodid)as ProdCount from order_sub
where orderformid in
(select distinct orderformid from order_sub
where prodid='006013'and dtime between '2003-8-20' and '2003-8-30')
and prodid<>'006013'
group by prodid order by prodcount desc,prodid
select distinct '006013' prodid,count(prodid)as ProdCount from order_sub
where orderformid in
(select distinct orderformid from order_sub
where prodid='006013'and dtime between '2003-8-20' and '2003-8-30')
and prodid<>'006013'
group by prodid order by prodcount desc,prodid
解决方案 »
- 请教一条SQL语句,在线等好心人解答
- 生成SQL脚本问题
- 查询查询分析器 insert 出错从字符串转换为 '01-Jan-1998' datetime 时发生语法错误。
- 关于区分大小写的问题
- distinct语法求助!
- with rollup和with cube何解啊,可以举个例子啊!
- 实际应用:如何得到相应的入库数量?
- 女友曾是别人的女人,痛苦中,也来这里散分。
- 求教:新手急问关于存储过程的本地变量
- 百分求教!Access中的表关系与SQLSERVER中的表关系区别?在SQLSERVER中一定要建立主健才能建立关系吗?
- 请高手路过务必看看:为何MS-SQL2000无法安装?
- SMALLDATETIME类型字段能否为‘空串’???
select distinct '006013',prodid,count(prodid)as ProdCount from order_sub
where orderformid in
(select distinct orderformid from order_sub
where prodid='006013'and dtime between '2003-8-20' and '2003-8-30')
and prodid<>'006013'
group by prodid order by prodcount desc,prodid
insert into table (a1,a2,a3)
select '006013',distinct prodid,count(prodid)
from order_sub
where ........
试试
insert into table (a1,a2,a3)
select distinct '006013', prodid,count(prodid)
from order_sub
where ........