set nocount on create table test (a int , b char(1)) create table test_tmp (a int , b char(1)) insert into test values (1, 'a') insert into test values (2, 'a') insert into test values (3, 'b') insert into test values (4, 'b') insert into test values (5, 'c') insert into test values (6, 'c') insert into test values (7, 'd') insert into test values (8, 'd') insert into test values (9, 'e') insert into test values (10, 'e') insert into test values (11, 'e') insert into test values (12, 'e') insert into test values (13, 'e') insert into test values (14, 'e') insert into test values (15, 'e') insert into test values (16, 'e') insert into test values (17, 'e') insert into test values (18, 'e') insert into test values (19, 'e') insert into test values (20, 'e') insert into test values (21, 'e') insert into test values (22, 'e') insert into test values (23, 'e') insert into test values (24, 'e') insert into test values (25, 'e') insert into test values (26, 'e') insert into test values (27, 'e') insert into test values (28, 'e') insert into test values (29, 'e') insert into test values (30, 'e') insert into test_tmp select top 25 * from test order by a asc select * from test_tmp where a in( select top 15 a from test_tmp order by a desc ) order by a asc drop table test_tmp drop table test -----Original Message----- From: Stuart To: David Felton Cc: Nadim Attari; php-windows@lists.php.net; Herhuth, Ron Sent: 2004-02-06 13:44 Subject: Re: SQL to select a set of records David Felton wrote: > SELECT TOP 10 dbo.Table_MIS_Files.File_ID > FROM dbo.Table_MIS_Files > WHERE dbo.Table_MIS_Files.File_ID NOT IN > (SELECT TOP 25 dbo.Table_MIS_Files.File_ID > FROM dbo.Table_MIS_Files) Shouldn't this be... SELECT TOP 25 dbo.Table_MIS_Files.File_ID FROM dbo.Table_MIS_Files WHERE dbo.Table_MIS_Files.File_ID NOT IN (SELECT TOP 10 dbo.Table_MIS_Files.File_ID FROM dbo.Table_MIS_Files) That will get rows 11-25. -- Stuart -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php