473,395 Members | 1,639 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,395 software developers and data experts.

How do I delete these extra rows from my table ?

290 100+
Hi,
I need to delete excess rows from my table, but ı am
not sure how to do it.

I don't need more than two updates to any item per day
so I want to delete extra ones from the table.

I can not use the unique or distinct filter because I want to allow up to
two rows per day for each item, and delete any above that number.

I have a table containing a weeks worth of daily updates to the my website.

The table contains four records in each row:

day_no, item, quality_score, votes
3, Feedbox, 6, 7
4, Grabber, 2, 23
4, Grabber 4, 20
4, Feedbox, 5, 5
5, Feedbox, 3, 15
6, Feedbox, 8, 31
4, Grabber 7, 4

So you see that last one on the list, that is the 3rd time that item has got an update for day 4, so that row should get deleted but the first two rows should stay intact.

I am not sure if the "DELETE from WHERE" is going to work here because that would probably delete all three rows, which is not what I want.
I just want to delete the 3rd ( and if they exist: the 4th, 5th ...nth rows )
and leave the first two .

Any ideas how this can be done ?

Thanks
Jan 22 '10 #1
0 1339

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

Similar topics

0
by: Gordon | last post by:
I have 2 tables t and t1. In this case, t1 is a copy of t. I want to delete rows from t1 based on criteria on the t table and a relationship between t ad t1 (in this case the id column). In the...
1
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB...
1
by: Patrizio | last post by:
Hi All, I've the following table with a PK defined on an IDENTITY column (INSERT_SEQ): CREATE TABLE MYDATA ( MID NUMERIC(19,0) NOT NULL, MYVALUE FLOAT NOT NULL, TIMEKEY ...
2
by: rc | last post by:
Hi I have a SQL2000 server with 128m rows of data. I want to delete about 65m of that. So far I have bcp'ed the relevent data out and put them into another SQL database. We have a small...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
1
by: deebeetwo | last post by:
I need to delete some rows from a table. The rows to delete are uniquely identified in a second table. I realize that I have two options here: 1) DELETE FROM tableA WHERE ... 2) MERGE INTO...
9
by: Dejan | last post by:
Hy, Sorry for my terreble english I have this simple code for deleting rows in mysql table... Everything works fine with it. So, what do i wanna do...: my sql table looks something like...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
0
by: dunleav1 | last post by:
I have a PMR opened with IBM support but they aren't getting anywhere fast. I have a very large table (hundreds of columns and millions of rows) This table is a parent table for 10 other tables...
29
by: shivasusan | last post by:
Hi! I can add rows with inputs to my HTML table dynamically using DOM, but I cannot remove selected rows. In fact, every row contains a Delete button. So, user selects the rows to remove, clicks...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.