select B.T1,convert(char(8),date,112)+cast(right(cast(10000+count(*)) as char),4) as char) T2
from 表 A join 表 B
on DateDiff(dd,A.T1,B.T1)=0 and A.T1<=B.T1 group by B.T1
from 表 A join 表 B
on DateDiff(dd,A.T1,B.T1)=0 and A.T1<=B.T1 group by B.T1
调试欢乐多
这是非技术版!!!select B.T1,convert(char(8),date,112)+cast(right(cast(10000+count(*) as char),4) as char) T2
from 表 A join 表 B
on DateDiff(dd,A.T1,B.T1)=0 and A.T1<=B.T1 group by B.T1
select convert(char(8),getdate(),112) ----20020101
from 表 A join 表 B
on DateDiff(dd,A.T1,B.T1)=0 and A.T1<=B.T1 group by B.T1
是不是这样:select Test.T1,convert(char(8),Test.T1,112)+cast(right(cast(10000+count(*) as char),4) as char)
T2 from A join Test on DateDiff(dd,A.T1,Test.T1)=0 and A.T1<=Test.T1 group by Test.T1
有些是应该自己就能解决的呀
希望你能成功
忠言一直逆耳