怎么使我每次不是更新数据库
而是覆盖上次的所有记录呢!
因为有时候时间条件不同
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
现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......