JPaulo Developer Local time Today, 03:10 Joined Dec 21, 2009 Messages 185 Mar 15, 2010 #1 Hi all; For vba cod, how to delete all records from a table tbltest, except the last 6 records where field 1 = "xpto" ?
Hi all; For vba cod, how to delete all records from a table tbltest, except the last 6 records where field 1 = "xpto" ?
V vbaInet AWF VIP Local time Today, 03:10 Joined Jan 22, 2010 Messages 26,374 Mar 15, 2010 #2 1. Sort in DESCENDING order 2. Save the first six IDs in an array 3. Use the NOT IN () function in the WHERE part of your DELETE statement: http://www.techonthenet.com/sql/in.php http://www.tizag.com/sqlTutorial/sqlin.php http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/sqlp/rbafyexsub5.htm http://www.youcanlearnseries.com/Programming Tips/SQL/Delete.aspx
1. Sort in DESCENDING order 2. Save the first six IDs in an array 3. Use the NOT IN () function in the WHERE part of your DELETE statement: http://www.techonthenet.com/sql/in.php http://www.tizag.com/sqlTutorial/sqlin.php http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/sqlp/rbafyexsub5.htm http://www.youcanlearnseries.com/Programming Tips/SQL/Delete.aspx