sql问题~
CREATE TABLE [conference12] (
[id] [bigint] IDENTITY (1, 1) NOT NULL ,
[title_name] [char] (50) COLLATE Japanese_CI_AS NULL ,
[user_code] [money] NOT NULL ,
[type_code] [bigint] NULL ,
[con_code] [int] NULL ,
[t_date] [datetime] NULL
) ON [PRIMARY]
GO
declare @j int
set @j=0
while @j <=10
begin
declare @o int
set @o=1
while @o <=10
begin
declare @m int
set @m=1
while @m <=10
begin
insert into conference(title_name,user_code,type_code,con_code ,t_date) values( 'hehe ',129,cast(@j as varchar(2)),cast(@o as varchar(2)) '2007-2- '+cast(@m as varchar(2))+ ' 3:00:00 ')
set @m=@m+1
end
set @o=@o+1
end
set @j=@j+1
end
需求 type_code=0为一个表A
余下的也为一个表 B
两个表之间的条件是 A.id=B.type_code
是一格在原表中排序问题~想了很长时间 不会~
order by 要by时间。。。
------解决方案--------------------declare @j int
set @j=0
declare @o int
set @o=1
declare @m int
set @m=1
while @j <=10
begin
while @o <=10
begin
while @m <=10
begin
insert into conference(title_name,user_code,type_code,con_code ,t_date) values( 'hehe ',129,cast(@j as varchar(2)),cast(@o as varchar(2)), '2007-2- '+cast(@m as varchar(2))+ ' 3:00:00 ')
set @m=@m+1
end
set @o=@o+1
end
et @j=@j+1
end