SQL 向表累加数据行 mySQL java
SQL 向表追加数据行 mySQL java 好久没有不见了,困扰很久的问题在今天终于解决了,以前一直用 select * into? table1 from? table2 假如需要将table1 追加数据,却没有办法,只能用中间table3 select * into table3 from ( select * from table1 union all selec
SQL 向表追加数据行 mySQL java好久没有不见了,困扰很久的问题在今天终于解决了,以前一直用
select * into? table1 from? table2
假如需要将table1 追加数据,却没有办法,只能用中间table3
select * into table3
from
(
select * from table1
union all
select * from table2
) data
--向表追加数据sql 语句
select * into #120 from
(
select 2 as source_type,D56.rkey,69 as fac from XXXXX d56
LEFT JOIN
(select * from data9287 where source_type =2) D9287 ON D9287.SOURCE_PTR=D56.RKEY
?where?? D9287.RKEY IS NULL AND tdate>='2013-09-01'
)AA
go
insert into data9287(source_type,source_ptr,plant_ptr)select source_type,rkey,fac from #120
go
Drop table #120
select * into #121 from
(
select 1 as source_type,D48.rkey,69 as fac from XXXXX D48
LEFT JOIN
(select * from data9287 where source_type =1) D9287 ON D9287.SOURCE_PTR=D48.RKEY
?where?? D9287.RKEY IS NULL AND tdate>='2013-09-01'
)AA
go
insert into data9287(source_type,source_ptr,plant_ptr)select source_type,rkey,fac from #121
go
Drop table #121
上一篇: PostgreSQL删除表中重复数据行
推荐阅读
-
针对mysql数据库无法在表中插入中文字符的解决方案(彻底解决:java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x92\x94‘ )
-
java-mysql表中改变一列数据的编号怎么让同编号的一行数据跟着变化?
-
java-mysql表中改变一列数据的编号怎么让同编号的一行数据跟着变化?
-
SQL 向表累加数据行 mySQL java
-
SQL 向表累加数据行 mySQL java
-
针对mysql数据库无法在表中插入中文字符的解决方案(彻底解决:java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x92\x94‘ )