日期:2014-05-18 浏览次数:20560 次
CREATE TABLE [dbo].[Wound]( [WoundID] [int] IDENTITY(1,1) NOT NULL, [Winding] [varchar](50) NULL, [TF_ID] [int] NULL, CONSTRAINT [PK_Wound] PRIMARY KEY CLUSTERED ( [WoundID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO insert into Wound values('NP1',1) insert into Wound values('NP1',1) insert into Wound values('NP2',1) insert into Wound values('NP3',1) insert into Wound values('NP2',1) insert into Wound values('NP3',2) insert into Wound values('NP3',2) insert into Wound values('NP1',2) insert into Wound values('NP1',2)
select * from Wound T where not exists (select 1 from Wound where T.[Winding]=[Winding] and T.[TF_ID]=[TF_ID] And T.[WoundID]>[WoundID] )