表A
id  nd   sj   gz
01 2007  01  2000
01 2007  02  1950
01 2007  03  2102
01 2006  11  2000
01 2006  10  1950
01 2006  12  2102
02 2007  01  3000
02 2007  02  3100
02 2006  11  3000
02 2006  12  3100
03 2007  01  2201
03 2007  02  2226
......   如何将表先按nd由小到大排序,再按sj由小到大排序,并想把id为01的人,2007年01月份以后记录删除?  谢谢各位大哥!

解决方案 »

  1.   

    select * from A order by nd asc,sj desc
      

  2.   

    delete from A where id='01 and nd='2007' and sj>'01'
      

  3.   

    更正:
    select * from A order by nd,sj delete from A where id='01' and nd='2007' and sj>'01'
      

  4.   

    请问这位哥哥,在VB中如何写呢?delete from A where id='01' and nd='2007' and sj>'01'
    提示有错误,请指教
      

  5.   

    Dim  conn As New Connection
        conn.ConnectionString = "PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=服务器名;DATABASE=数据库名;UID=用户;PWD=密码"
        conn.Execute ("delete from A   where [id]='01' and nd ='2007' and convert(int,sj)>1   ")