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

解决方案 »

  1.   

    但是语句说是'cast' 附近有语法错误,需要 'AS'。
      

  2.   

    你把你的问题转到技术版去!!!
    这是非技术版!!!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
      

  3.   

    请解释语句的内容convert(char(8),date,112中DATE,112是什么意思
      

  4.   

    select CONVERT(varchar(10), getDate(),120) --不要时间2002-1-1
    select convert(char(8),getdate(),112) ----20020101
      

  5.   

    select B.T1,convert(char(8),B.T1,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
      

  6.   

    pengdali(大力):语句要怎么写??
      是不是这样: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
      

  7.   

    其实你可以在文档中查这个函数的用法,convert
    有些是应该自己就能解决的呀
    希望你能成功
    忠言一直逆耳