|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
how to delimit a size of a table
hi
how to delimit a size of a table? i'd like to have only 100 records should i delete one with the lowest id and run update which decrease others id by 1 and the insert new one? i think that will be very hard to run many task like that any ideas ? |
|
#2
|
|||
|
|||
|
RE: how to delimit a size of a table
You want to have 100 records all the time or just delete old ones from time to time?
In the first case just do DELETE FROM table where id=min(id); and then insert the new record. In the second case: DELETE FROM table where id<min(id)+100; And just run the statement from time to time - put it into a file and schedule the program to run every 10 minutes. |
|
#3
|
|||
|
|||
|
RE: how to delimit a size of a table
Another sugestion could be to use triger to automaticaly delete oldest row when new row will be inserted and when there is already 100 records in table.
|
|
#4
|
||||
|
||||
|
RE: how to delimit a size of a table
I've seen triggers mentioned in a couple threads lately. MySQL does not have stored procedures of any kind - they are slated to be implemented sometime around version 5.0. Triggers are scheduled for version 5.1. See this page for details.
|
|
#5
|
|||
|
|||
|
RE: how to delimit a size of a table
Oh, then sorry. I have never worked with mySQL.
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > how to delimit a size of a table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|