Delete All But The Latest One
Hi there,
I got a lots of Database entries. Now I want to delete all but the latest one. How does that work?
Denis
Hi there,
I got a lots of Database entries. Now I want to delete all but the latest one. How does that work?
Denis
Just a stab in the dark, but retrieve the recordset ordered by the unique ID field descending.
Store that Unique ID in a Session Variable and then delete all records that are not equal to that Session Variable.
The DA Delete code may need some manual tweaking for that though..
Cheers
Ian
You could probably just use a query like:
DELETE FROM tablename WHERE tableID <> (SELECT tableID FROM tablename ORDER BY tableID DESC Limit 1)
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.