473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to delete the 10 records with the lowest id's

Thew
69
i try to create a system that if there are 50 records in my database, the 10 with the lowest id's get deleted. How can i do that?

Edit: Title wrong, not delteting but deleting
Sep 1 '10 #1
4 2048
wizardry
201 100+
you could create a procedure and have that procedure grab the date/time from the table and id and set an if ID <= MAX_Id then

delete ID
Sep 1 '10 #2
Thew
69
Can you please write an example code? I am new to mysql
Sep 1 '10 #3
JKing
1,206 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM your_table
  2. ORDER BY your_id
  3. LIMIT 10
That will delete 10 records with the lowest ID
Sep 1 '10 #4
Thew
69
Thank you!
Sep 1 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: luc wastiaux | last post by:
Hello, I am writing an application to handle support requests, and the user needs to have his request number printed out in front of him even before he hits the "submit" button. I have no idea how...
0
by: George Dainis | last post by:
How do I code a SQL SELECT statement so that always only this record is retrieved which matches a certain criteria AND has the lowest ID (= value in key field aaa)? It must me something like ...
2
by: Fatou | last post by:
I have a listbox where the user selects only one value at a time. The problem is that once the user selects the value and the record is updated in the table, they can reselect the same value...
1
by: Heather | last post by:
I know this is a painful question and I have searched the group for past responses and none of the responses seem to cover my specific need. We have a table that contains fields like ID, Yr,...
3
by: John Duchowski | last post by:
I've got a fairly large Access file with 4899 records. The ID field runs sequentially but misses two rows: it skips 3727 and 3740. Consequently, the dbase indicates that I have 4901 rows where in...
38
by: Rex | last post by:
In a table, I have number of records belonging to a particular ID now if I enter a value in one of the fileds of this table I want it to be copied in all the records belonging to this particluar...
1
by: aayushi22 | last post by:
Hi Need your expert help on the following i have a table with the following records EMP ID Req No Candidate name 1 candidate status 1 candidate name 2
1
by: HansyW | last post by:
I have a stored procedure MY_proc which returns records with a variety of IDs (X, Y, Z) . I would like to open stored procedure and select all records where ID=X before I continue my process....
5
by: davenet | last post by:
Hi, I'm new to Python and working on a school assignment. I have setup a dictionary where the keys point to an object. Each object has two member variables. I need to find the smallest value...
13
by: Charlotte | last post by:
Hi, i've googeled to find a asp-script that can compare all the records in two different access databases the mdb's have exactly the same tables what i want is that (the output) all the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.