set rs = cn.EXECute( "select max(bh) as max_bh from tb ")
if split(rs!max_bh, "- ")(0)=year(date) then new_bh=split(rs!max_bh, "- ")(0) & "- " & cint(split(rs!max_bh, "- ")(1))+1 else new_bh=year(date) & "- " & "1 " end if
这个不知道是不是你要的?
发表于:2007-07-23 13:29:376楼 得分:0
以下是sql2000如果是access 把getdate() 改成 now() select convert(varchar(4), year(getdate()))+ '- '+convert(varchar(10),count(*)+1) as bh from smt_ads where year(smt_lasttime)=year(getdate())
发表于:2007-07-23 13:30:537楼 得分:0
select convert(varchar(4), year(getdate()))+ '- '+convert(varchar(10),count(*)+1) as bh from tablename where year(sdate)=year(getdate())