I need a solution to remove all records but save last 10 by ID_URL not BY UNIQUE ID (primary Key)..
MY Database Structure and Records View..
I need to save last 10 ITEM of EVERY URL_ID..
EDIT: Maybe most or are you confused what I am asking about.. actually I just want to save NEW 10 EVERY URL_ID records only..
ID IP TIME(TIMESTAMP) BROWSER Visitor_URL URL_ID
11 xxx.xxx.xx.xx 3/15/2010 14:43 Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 V... link_link TYTIP
12 xxx.xxx.xx.xx 3/15/2010 14:43 Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 V... link_link TITPE
13 xxx.xxx.xx.xx 3/15/2010 14:43 Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 V... link_link XAIP
14 xxx.xxx.xx.xx 3/15/2010 14:44 Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 V... link_link TYTIP
15 xxx.xxx.xx.xx 3/15/2010 14:44 Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 V... link_link TYTIP
.....1000's of Other Records
Can you make a predefined list of
url_id?Because then you can do:
This will delete in reverse order, skipping the first 10 rows (and since it’s in reverse, those are the most recent rows).
PS. Be sure to test this before trying it on live data.