不好意思,没表达好。
这个数据库是双主键。(姓名+出生日期)
最新的是指,上次查询时表中还没有的数据。打个比方,就像我看书,看了一半肯定要做记号,下次接着看。
查询过的数据,我不再去查询了。我就想知道在sqlserver数据库中这个记号怎么作。不知道有没有说明白?

解决方案 »

  1.   

    if object_id('tb') is not null
    begin 
    drop table tb
    end
    gocreate  table tb(id int,num int)
    insert into tb
    select '1','1'
    union all
    select '2','2'
    union all
    select '3','3'
    union all
    select '1','1'
    go--先加一个主增列充当主键,等完成后进后删除
    alter   table   tb 
    add   ad int identity(1,1)
    go
    delete from tb
    where ad not in(select max(ad) from tb group by id,num)
    goalter table tb  drop column ad
    go
    go
    select * from tb