If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to use Delete Query for specific for rows 5
I would to use a Delete Query for all rows of Table A after Row #5.
Is there a way I can filter so the delete query remove Rows 5 in Table A ? Thank you |
#2
|
|||
|
|||
How to use Delete Query for specific for rows 5
The concept of a row number is completely foreign to a table in a relational
database. Tables are sets and as such have no intrinsic order. You'll need to specify a sort order which determines which are the top 5 rows you want to retain. Assuming you can do this on a column in the table then you'd use a subquery to return the top 5 rows and restrict the rows deleted to those not returned by the subquery, e.g. DELETE * FROM [Table A] WHERE [YourField] NOT IN (SELECT TOP 5 [YourField] FROM [Table A] ORDER BY [YourField]); Ken Sheridan Stafford, England Steph_canoe wrote: I would to use a Delete Query for all rows of Table A after Row #5. Is there a way I can filter so the delete query remove Rows 5 in Table A ? Thank you -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...eries/200911/1 |
Thread Tools | |
Display Modes | |
|
|