mysql下sql语句 update 字段=字段+字符串
mysql下sql语句令某字段值等于原值加上一个字符串
update 表明 SET 字段= 'feifei' || 字段; (postgreSQL 用 || 来连贯字符串)
MySQL连贯字符串不能利用加号(+),而利用concat。
比方在aa表的name字段前加字符'x',利用:
update aa set name=concat('x',name)
YEARWEEK(date_format(FOrderDate,'%Y-%m-%d'),1) = YEARWEEK(now(),1) 本周
date_format(Date,'%Y-%m-%d') 日期
TO_DAYS(NOW())
select count(FId) from TcOrder where date_format(FOrderDate,'%Y-%m')=date_format(now(),'%Y-%m') 本月
select count(FId) from TcOrder where YEARWEEK(date_format(FOrderDate,'%Y-%m-%d'),1) = YEARWEEK(now(),1) 本周
select count(FId) from TcOrder where TO_DAYS(NOW()) - TO_DAYS(FOrderDate)=1 昨日
select count(FId) from TcOrder where TO_DAYS(NOW()) = TO_DAYS(FOrderDate) 今日
select count(FId) as f,sum(FReceivableAmount) as r from TcOrder where (FStatus='Payed' or FStatus='Finished') "+role +" and FPayDate BETWEEN ? AND ?";//7日内金额
mysql下sql语句令某字段值等于原值加上一个字符串
update 表明 SET 字段= 'feifei' || 字段; (postgreSQL 用 || 来连贯字符串)
MySQL连贯字符串不能利用加号(+),而利用concat。
比方在aa表的name字段前加字符'x',利用:
update aa set name=concat('x',name)
YEARWEEK(date_format(FOrderDate,'%Y-%m-%d'),1) = YEARWEEK(now(),1) 本周
date_format(Date,'%Y-%m-%d') 日期
TO_DAYS(NOW())
select count(FId) from TcOrder where date_format(FOrderDate,'%Y-%m')=date_format(now(),'%Y-%m') 本月
select count(FId) from TcOrder where YEARWEEK(date_format(FOrderDate,'%Y-%m-%d'),1) = YEARWEEK(now(),1) 本周
select count(FId) from TcOrder where TO_DAYS(NOW()) - TO_DAYS(FOrderDate)=1 昨日
select count(FId) from TcOrder where TO_DAYS(NOW()) = TO_DAYS(FOrderDate) 今日
select count(FId) as f,sum(FReceivableAmount) as r from TcOrder where (FStatus='Payed' or FStatus='Finished') "+role +" and FPayDate BETWEEN ? AND ?";//7日内金额