日期:2014-05-17 浏览次数:20533 次
create table A表(dt varchar(15))
create table B表
(dt varchar(16), 时辰数字 int, 时辰 varchar(5))
insert into A表(dt)
select '1900-01-01' union all
select '1900-01-02' union all
select '1900-01-03' union all
select '1900-01-04' union all
select '1900-01-05'
insert into B表
select a.dt,s.时辰数字,s.时辰
from A表 a
cross join
(select 1 '时辰数字', '子' '时辰' union all
select 2 '时辰数字', '丑' '时辰' union all
select 3 '时辰数字', '寅' '时辰' union all
select 4 '时辰数字', '卯' '时辰' union all
select 5 '时辰数字', '辰' '时辰' union all
select 6 '时辰数字', '巳' '时辰' union all
select 7 '时辰数字', '午' '时辰' union all
select 8 '时辰数字', '未' '时辰' union all
select 9 '时辰数字', '申' '时辰' union all
select 10 '时辰数字', '酉' '时辰' union all
select 11 '时辰数字', '戌' '时辰' union all
select 12 '时辰数字', '亥' '时辰') s
select dt,时辰数字,时辰 from B表
/*
dt 时辰数字 时辰