insert into t6 select * from (select * from t1 union all select * from t2 union all select * from t3 union all select * from t4 union all select * from t5) b
insert into t6(f1,f2,f3,fn) select f1,f2,f3,fn from t1 where convert(char(5),时间,114) between '0:00' and '1:00' union all select f1,f2,f3,fn from t2 where convert(char(5),时间,114) between '1:00' and '2:00'
select * into t6 from ( select * from t1 union all select * from t2 union all select * from t3 union all select * from t4 union all select * from t5 ) t
insert into t6 select * from t1 union all select * from t2 union all select * from t3 union all select * from t4 union all select * from t5
insert into t6(f1,f2,f3,fn) select * from ( select f1,f2,f3,fn from t1 where convert(char(5),时间,114) between '0:00' and '1:00' union all select f1,f2,f3,fn from t2 where convert(char(5),时间,114) between '1:00' and '2:00' union all select f1,f2,f3,fn from t3 where convert(char(5),时间,114) between '2:00' and '3:00' union all select f1,f2,f3,fn from t4 where convert(char(5),时间,114) between '3:00' and '4:00' union all select f1,f2,f3,fn from t5 where convert(char(5),时间,114) between '4:00' and '5:00' ) t
select * into t6(f1,f2,f3,fn) from ( select f1,f2,f3,fn from t1 where convert(char(5),时间,114) between '0:00' and '1:00' union all select f1,f2,f3,fn from t2 where convert(char(5),时间,114) between '1:00' and '2:00' union all select f1,f2,f3,fn from t3 where convert(char(5),时间,114) between '2:00' and '3:00' union all select f1,f2,f3,fn from t4 where convert(char(5),时间,114) between '3:00' and '4:00' union all select f1,f2,f3,fn from t5 where convert(char(5),时间,114) between '4:00' and '5:00' ) t
Select * Into T6 From ( Select 字段1 From T1 union all Select 字段1 From T2 union all Select 字段1 From T3 union all Select 字段1 From T4 union all Select 字段1 From T5 )M
请问f1 f2 f3 这些是什么,表格里面的列吗?
insert into t6 select * from (select * from t1 union all select * from t2 union all select * from t3 union all select * from t4 union all select * from t5) b where datacol = ??
select *
from (select * from t1 union all
select * from t2 union all
select * from t3 union all
select * from t4 union all
select * from t5) b
select f1,f2,f3,fn
from t1
where convert(char(5),时间,114) between '0:00' and '1:00'
union all
select f1,f2,f3,fn
from t2
where convert(char(5),时间,114) between '1:00' and '2:00'
select * into t6 from
(
select * from t1
union all
select * from t2
union all
select * from t3
union all
select * from t4
union all
select * from t5
) t
select * from t1 union all
select * from t2 union all
select * from t3 union all
select * from t4 union all
select * from t5
select *
from
(
select f1,f2,f3,fn
from t1
where convert(char(5),时间,114) between '0:00' and '1:00'
union all
select f1,f2,f3,fn
from t2
where convert(char(5),时间,114) between '1:00' and '2:00'
union all
select f1,f2,f3,fn
from t3
where convert(char(5),时间,114) between '2:00' and '3:00'
union all
select f1,f2,f3,fn
from t4
where convert(char(5),时间,114) between '3:00' and '4:00'
union all
select f1,f2,f3,fn
from t5
where convert(char(5),时间,114) between '4:00' and '5:00'
) t
from
(
select f1,f2,f3,fn
from t1
where convert(char(5),时间,114) between '0:00' and '1:00'
union all
select f1,f2,f3,fn
from t2
where convert(char(5),时间,114) between '1:00' and '2:00'
union all
select f1,f2,f3,fn
from t3
where convert(char(5),时间,114) between '2:00' and '3:00'
union all
select f1,f2,f3,fn
from t4
where convert(char(5),时间,114) between '3:00' and '4:00'
union all
select f1,f2,f3,fn
from t5
where convert(char(5),时间,114) between '4:00' and '5:00'
) t
(
Select 字段1 From T1
union all
Select 字段1 From T2
union all
Select 字段1 From T3
union all
Select 字段1 From T4
union all
Select 字段1 From T5
)M
select *
from (select * from t1 union all
select * from t2 union all
select * from t3 union all
select * from t4 union all
select * from t5) b
where datacol = ??
我试试……
呵呵,俺是SQL的门外汉……见笑了
包括了