Sql Server 去重复数据
我的数据库中有一个Order表 里面字段为
orderId amount qty
100100 -100 -1
100100 100 1
现在 我想查询时 去掉这两条数据 不是删除 只是想查询时将这两天数据同时剔除
两条都去掉??
SQL code:
select *
from [Order] t
where exists(select 1
from [Order]
where orderId=t.orderId
group by orderId having count(*)=1)
select * from Order
where orderId<>100100 and (( amount<>-100 andqty<>-1)
or (amount<>100 andqty<>1))
两条都去掉??
SQL code:
select * from Order group by orderId,amount,qty having count(*)=1
select * from tb t where not exists(select 1 from tb where (orderId=t.orderId and t.amount<>amount) or (orderId=t.orderId and amount<>t.amount))
SQL code:
select * from Order a
where not exists(select 1 from Order where a.orderId=orderId group by orderId having count(*)>=2)
SQL code:
select order
相关问答:
执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
场景如下:
客户把备份好的数据库,发给我,我在本机还原后,运行写好的存储过程,比较快,并且在实施那边运行同样比较快。但是当实施在客户那边运行的时候速度就非常的慢,时间超出了程序的时间限制。远程在客户那 ......
今天做了一个存储过程 环境是SQL2000数据库
大致如下
建立临时表
定义员工游标
循环员工(属于1个公司)
......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......