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
相关问答:
执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......
可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
select o_customer,o_price from orders having o_price >=avg(o_price)
select o_customer,o_price from orders where o_price >=(select avg(o_price) from orders)
我感觉没有区别啊,怎么在mysql会有 ......
执行数据库操作时,直接用SQL 语句好一些 还是用存储过程更佳呢?
各抒起见
这个的具体问题具体分析
简单的select 、update和insert当然sql解决了
复杂的放在sql服务端应该好点
楼主请参阅
http://msdn.micr ......