delete num rows exceeding 20

wxdqz

New Member
i have a table like:

id = int, auto_incr.
browser = varchar
os = varchar
referer = varchar

and in php something that "select count(*) from table" etc. etc. returning the num of rows...

but if rows is >20, how do I remove the oldest one? I have some ideas, but none work (of course...).

am I on the right path? :
1. get 'id' from last row
2. substract 20
3. "delete from table where id < '$id'"

thanks in advance =)

// Thomasson
 
Back
Top