Skip to content
Advertisement

Tag: duplicates

SQL query for duplicate rows based on 2 columns

I have 3 tables movie, rating and reviewer movie has 4 columns movieID, title, year, director rating has 4 columns reviewerID, movieID, stars, ratingDate reviewer has 2 columns reviewerID, name How do I query reviewer who rated the same movie more than 1 time and gave it higher rating on the second review. This is my attempt at query to

How to delete rows that have duplicate column combination

I need to delete some rows that have the same column combination (except ID). The row that should be kept is the one that has the maximum reference date So, after the query the table should be like this I know that the query below will return the table I want, but I don’t know how to delete the “duplicate”

Duplicated inner join results

With postgres I’m trying to get a single user and all their posts, but when I inner join the Users and Posts tables I receive this: QUERY: I’m also trying to do the same thing but as a json QUERY: I know why but I don’t know how to avoid it, can someone help me to get something like this:

SQL for finding multiple column matches (dups)

I’m trying to write a query to find all rows that have three columns in common with other rows. Imagine a person can only send one letter to another per day and I need to identify “dups” even though all of the columns may not be the same. I want to see all rows that have the same Sender_ID AND

Trying to delete duplicate rows in SQL Server where the difference is the date or batch number

I have this query: Which is returning the following results ID_NUMBER INCEPTION_DATE OCCURRENCE TRANSACTION_DATE FILE_LOAD_DATE BATCH_NUM 112897732 2008-09-15 4 2008-07-03 2008-07-07 17:57:19 06341 112897732 2008-09-15 4 2008-07-13 2008-07-18 03:35:55 06753 828194721 2008-11-11 1 2008-09-06 2008-09-17 02:50:44 97334 828194721 2008-11-11 1 2008-09-23 2008-09-24 02:55:27 98331 456457422 2008-09-28 1 2008-12-03 2008-07-13 08:08:39 00734 456457422 2008-09-28 1 2008-12-03 2008-07-18 13:35:55 00991 999272910 2008-05-07

Remove duplicates with least row ids from Oracle

I have a database table which looks like ID Book_no Book_name Book_category ID1 1 B1 CB1 ID1 2 B1 CB1 ID1 3 B2 CB1 ID1 4 B2 CB1 ID1 5 B3 CB1 ID2 1 B1 CB2 ID2 2 B1 CB2 ID2 3 B2 CB2 And the expected result is like ID Book_No Book_name Book_category ID1 2 B1 CB1 ID1 4

Advertisement