加多两个字段??什么意思??create table #t
(id int ,item char(10),id1 int ,item1 char(10))这样吗??
(id int ,item char(10),id1 int ,item1 char(10))这样吗??
解决方案 »
- 数据库SQL2000和VC6.0连接的问题
- 请教这个取值条件如何完成
- 如何查询Sq lServer中执行的语句来自于哪些IP
- sql server profiler 死锁文件中的sql语句参数值
- 关于SQLsever2000的一些问题,找高手解决啊
- 在做加减法时把字符串值换成整数?????
- sql server 2005不支持dt_date和dt_dbtimestamp转换,怎么解决?
- ++ 查询SQL语句的问题!!在线即时给分 ++
- 请教:使用SQLDMO怎么能取得sql Server 数据库的数据目录\MSSQL\Data?
- 请问一个有关VFP的问题
- DTS的奇怪問題,請高手救急...100分在線結貼
- 求一SQL字令
先加個字段select identity(int,1,1)as ID,* into #temp from #t
然後偶數放進一個表,奇數放一個表(以ID)
1>然後用以個inner join
再把2表合一表一定行
2>用case when 提示:id1=case id when 0 then id
.....
id ,
item,
(Select id from #TT Where Idd=A.Idd+1) As id1,
(Select item from #TT Where Idd=A.Idd+1) As item1
from #TT A
Where Idd%2<>0--结果
/*
id item id1 item1
1 1 2 1
3 1 5 21
21 231 61 11
*/
(id int ,item char(10))insert into #t
select 1,1
union
select 2,1
union
select 3,1
union
select 5,21
union
select 61,11
union
select 21,231select * from #t
drop table #tselect identity(int,1,1) as Tid,* into #a from #tselect * into #b from (select * from #a where Tid%2=1)T
select TID,id as id1,item as item1 into #c from(select * from #a where Tid%2=0)T
select * from #c
select * into #t from (select #b.id,#b.item,#c.id1,#c.item1 from #b,#c where #c.TID=#b.TID+1)T
select * from #t
---刪除測試環境
drop table #a,#b,#c
paoluo(一天到晚游泳的鱼) ( ) 信誉:100