楼上的是可以
要是数据少可以
但我的数据有20000条以上,并且类似的表有4张。。
不用SQL不行的

解决方案 »

  1.   

    select 姓名,年纪,性别 into <newtable> from hhh group by 姓名,年纪,性别
      

  2.   

    对了  楼上的,看了你的语句不太对啊我要以姓名为参照的。姓名     年纪     性别        登陆网站时间
    张三      15       女         12:00
    张三      15       女         1:00
    张三      15       女         15:00
    李四      16       男         15:21
    李四      16       男         14:15
    李四      16       男         17:51
    李四      16       男         12:11
    王五      17       男         15:15
    王五      17       男         18:02
    王五      17       男         12:02
    王五      17       男         3:03
    李四      16       男         15:15
    张三      15       女         12:12
    张三      15       女         7:7如过是这样的话上面的SQL语句就不可以了。
    对于上面的表要的到的就是登陆网站的人的名单再赐教~!
      

  3.   

    delete a
    from hhh a 
    where 登陆网站时间<>(select max(登陆网站时间) from hhh where 姓名=a.姓名)
      

  4.   

    我的方法是这样的,将你的表A复制一个表B,然后建一个新表C结构和A表的结构相同!然后用下面的语名就好了,这个我在查询管理器中通过了!你试试!
    insert c(姓名,年纪,性别,登陆网站时间) select distinct a.姓名,a.年纪,a.性别,a.登陆网站时间 from a,b where a.姓名=b.姓名
      

  5.   

    楼主说的意思是distinct或者group by,然后插入另一张表不就行了吗
    或许我没看清楚楼主的意思了
      

  6.   

    select distinct 姓名,年纪,性别 into <newtable> from hhh group by 姓名,年纪,性别
      

  7.   

    delete a
    from hhh a
    where 登陆网站时间<>(select max(登陆网站时间) from hhh where 姓名=a.姓名)这种方法,我想是可以的,但如果数据上万条的话,我想要比用临时表慢
      

  8.   

    select distinct 姓名,年纪,性别 into <newtable> from hhh group by 姓名,年纪,性别
    试了,好象是把hhh 表有复制到newtable了。
      

  9.   


    select distinct 姓名,年纪,性别 into <newtable> from hhh group by 姓名,年纪,性别
    注意这里没有选择“登陆网站时间”
      

  10.   

    --参考--删除重复的记录 create table t1(id int identity(0,1),a varchar(10),b varchar(10))
    insert t1(a,b)
    select 'aa','bb'
    union all select 'a1','bgb'
    union all select 'aa','bb'
    union all select 'a2','bb'
    union all select 'aa3','beeb'
    union all select 'aa','bb'
    union all select 'a2','bb'delete t1 
    where id not in 
    (select min(id) as id from t1 group by a,b)----------------a,b重复.-----------select * from t1drop table t1/*
    id      a       b
    ------------------
    0 aa bb
    1 a1 bgb
    3 a2 bb
    4 aa3 beeb*/
      

  11.   

    因为你的表没有主标识键.
    先增加标识键.
    select *,id identity(int,1,1) into #t from hh然后再执行上面的操作..........
      

  12.   

    select distinct * from hhh;