update issue a join TABLE b on on a.id=b.isid set a.group_date= b.groupDate

简介: update issue a join TABLE b on on a.id=b.isid set a.group_date= b.groupDate update issue a join (SELECTiss.

update issue a join TABLE b on on a.id=b.isid set a.group_date= b.groupDate

<update id="batchUpdateIssueGroupDate">
    <![CDATA[

    
    
    ]]>
</update>

update issue a join (SELECT
iss.id isid,
@cdate := iss.commit_date input_date,
@last_sat := date_add(date_sub(date_sub(@cdate,interval day(@cdate)-1 day),interval 1 month), interval 6-date_format(date_sub(date_sub(@cdate,interval day(@cdate)-1 day),interval 1 month),'%w') day) last_sat,
@this_sat := date_add(date_sub(@cdate,interval day(@cdate)-1 day), interval 6-date_format(date_sub(@cdate,interval day(@cdate)-1 day),'%w') day) this_sat,
@next_sat := date_add(date_add(date_sub(@cdate,interval day(@cdate)-1 day),interval 1 month), interval 6-date_format(date_add(date_sub(@cdate,interval day(@cdate)-1 day),interval 1 month),'%w') day) next_sat,
@last_point := if(day(@last_sat)-3>0,date_sub(@last_sat,interval 7 day),@last_sat) last_point,
@this_point := if(day(@this_sat)-3>0,date_sub(@this_sat,interval 7 day),@this_sat) this_point,
@next_point := if(day(@next_sat)-3>0,date_sub(@next_sat,interval 7 day),@next_sat) next_point ,
case when @cdate >= @last_point and @cdate < @this_point then
concat(
'W',
datediff(@cdate,@last_point) div 7 + 1, '/',
year(@cdate),'-',
if(month(@last_sat)>=10,month(@last_sat),concat('0',month(@last_sat)))
)
when @cdate >=@this_point and @cdate < @next_point then
concat(
'W',
datediff(@cdate,@this_point) div 7 + 1,'/',
year(@cdate),'-',
if(month(@this_sat)>=10,month(@this_sat),concat('0',month(@this_sat))))
else
concat(
'W',
datediff(@cdate,@next_point) div 7 + 1,'/',
year(@cdate),'-',if(month(@next_sat)>=10,month(@next_sat),concat('0',month(@next_sat))))
end
as groupDate from issue iss) b
on a.id=b.isid

set a.group_date= b.groupDate;

相关文章
|
8月前
|
SQL Oracle 关系型数据库
实时计算 Flink版操作报错之往GREENPLUM 6 写数据,用postgresql-42.2.9.jar 报 ON CONFLICT (uuid) DO UPDATE SET 语法有问题。怎么解决
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
|
SQL Java 关系型数据库
h2下update set字段重复处理拦截器
h2下update set字段重复处理拦截器
75 0
|
SQL Oracle 关系型数据库
Oracle中,UPDATE SET子句
Oracle中,UPDATE SET子句
640 1
|
分布式计算 Java Hadoop
Error: JAVA_HOME is incorrectly set. Please update C:\hadoop-2.5.1\conf\hadoop-env.cmd ‘
Error: JAVA_HOME is incorrectly set. Please update C:\hadoop-2.5.1\conf\hadoop-env.cmd ‘
|
网络架构
CodeIgniter报错: You must use the "set" method to update an entry
I'm using codeigniter/datamapper to develop an inviocing application and I'm getting an error that i don't understand.
2159 0
Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to “*****”
Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to “*****”  的一种解决方案:   修改工程依赖的build.
1092 0
|
NoSQL 关系型数据库 数据库
3.非关系型数据库(Nosql)之mongodb:升降序排序,排序分页,$all,$in,$nin,$or,$nor, $exists,游标,更新(update,$set,$unset,$inc)
 1排序sort() A降序排列 db.c4.find().sort().sort({age:-1}); B升序排列: db.c4.find().sort({age:-1}); C排序分页 db.collectionName.find().sort({age:-1}).skip(2
1271 0