sql数据覆盖!
怎么使我每次不是更新数据库
而是覆盖上次的所有记录呢!
因为有时候时间条件不同
SQL code:
select * from hwouttb where
CAST(REPLACE(REPLACE(REPLACE(outdate,'年','-' ),'月','-'),'日','') AS DATETIME)
between
CAST(REPLACE(REPLACE(REPLACE('2007年10月25日','年','-' ),'月','-'),'日','') AS DATETIME)
and
CAST(REPLACE(REPLACE(REPLACE('2007年10月25日','年','-' ),'月','-'),'日','') AS DATETIME)
and (gysh like '%生產%' or gysh like '%工程%' or gysh like '%倉庫%')
union all
select * from hwouttb2 where
CAST(REPLACE(REPLACE(REPLACE(outdate,'年','-' ),'月','-'),'日','') AS DATETIME)
between
CAST(REPLACE(REPLACE(REPLACE('2007年10月25日','年','-' ),'月','-'),'日','') AS DATETIME)
and
CAST(REPLACE(REPLACE(REPLACE('2007年10月25日','年','-' ),'月','-'),'日','') AS DATETIME)
and (gysh like '%生產%' or gysh like '%工程%' or gysh like '%倉庫%')
什么意思?
看不懂,有请小P梁.
sql少copy的一行
就是第一次假如是100条记录
第二次是50条记录
那么我在数据库hwouttb3
也只有50条刚才的记录
SQL code:
insert into hwouttb3
select * from hwouttb where
CAST(REPLACE(REPLACE(REPLACE(outdate,'年','-' ),'月','-'),'日','') AS DATETIME)
between
C
相关问答:
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......
现在有一个部门表dept(部门名称,部门号。。)有一个人员表emp(姓名,人员编号,职位,薪资,部门)
emp表中的内容是这样的:
a 1 工程师 3000 软件部
b 2 普通员工 2000 硬件部
c 3 工程师 4000 硬件部
d ......
SQL code:
rs.open "select * from guide where city_name='北京' order by pai desc",conn,1,1
do while not rs.eof or rs.bof
。。
。。
。。
rs.movenext
loop
这个sql语句在wap站里 本身有 ......
执行数据库操作时,直接用SQL 语句好一些 还是用存储过程更佳呢?
各抒起见
这个的具体问题具体分析
简单的select 、update和insert当然sql解决了
复杂的放在sql服务端应该好点
楼主请参阅
http://msdn.micr ......