ÇóSQLÓï¾ä
if object_id('class')is not null
drop table class
if object_id('student')is not null
drop table student
if object_id('score')is not null
drop table score
create table class
(
cid varchar(3),
classname varchar(20)
)
create table student
(
Sid varchar(5),
Sname varchar(20)
)
create table score
(
cid varchar(3),
Sid varchar(5),
cj int
)
insert into class values('001','1')
insert into class values('002','2')
insert into class values('003','3')
insert into student values('001','a')
insert into student values('002','b')
insert into student values('003','c')
insert into student values('004','d')
insert into student values('005','e')
insert into student values('006','f')
insert into student values('007','g')
insert into student values('008','h')
insert into student values('009','i')
insert into student values('010','j')
insert into score values('001','001',46)
insert into score values('001','002',20)
insert into score values('001','003'
Ïà¹ØÎÊ´ð£º
´ó¼Ò°ïæ¿´¿´Õâ2¸ösqlÓï¾äÄĸö²éѯµÄËٶȸü¿ìµã¡£Ð»Ð»°ïæ¡£±È½Ï׿±¡£ÔÚ×öÐÔÄܲâÊÔ¡£
select * from
±íA LEFT OUTER JOIN ±íB ON (±íA.id || ' ' =±íB.id) ,±íC , ±íD, ±íE
WhereÆäËûÌõ¼þ
select * ......
ÎÒÒªµÃµ½Ò»¸ö×Ö·û´®È磺
sdfk|||sgts
sdfsfd|||rgreg
wrfw|||sefw
¾ÍÊÇÒªµÃµ½|||ºóÃæµÄ×Ö·û´®£¬ÓÐʲôº¯ÊýÂð£¿ÔõôÓÃÄØ£¿Ð»Ð»£¡
SQL code:
select
right(col,len(col)-charindex('|||',col)-2)
f ......
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
--drop table #T1
--drop table #T2
create Table #T1(ID int,
QueryID nvarchar(20),
ResultID1 nvarchar(20),
ResultID2 nvarchar(20))
create Table #T2(SortNo int,
QueryID nvarchar(20),
ResultID1 nv ......