Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
503 views

Remove consecutive duplicate rows from a table

I am stuck on a problem. I want to remove consecutive duplicate records in the table, I,e, in the below table I want to calculate the total cost without consecutive duplication. Like, row 3 should be ...
Namra Rehman's user avatar
-2 votes
2 answers
66 views

Remove duplicates in single column from view in SQL Server? [duplicate]

I (beginner SQL user) have a SQL Server view, created with the following statement: CREATE VIEW dbo.v_LSitesGeo AS SELECT PS.LSiteID, GEO.geographyColumn FROM dbo.Project_SiteID_Lookup AS ...
traitortots's user avatar
0 votes
1 answer
194 views

SqlDataAdapter.Fill running SQL command twice

I'm trying to insert a new row in my SQL database from ASP.NET but it's inserting the row twice instead of once. I haven't been able to find which line of the code below is causing this. Here's my ...
Halima Ghannoum's user avatar
0 votes
0 answers
22 views

Retrive records in buckets from a freq. updating transactional table based on limit and offset from SQL Server into data warehouse resulting duplicate

I have a pipeline that will load data from SQL Server to a warehouse based on the limit and offset by partitioning it into five buckets. Since the data from the source is updating frequently, for ...
Trakmaker's user avatar
-2 votes
1 answer
63 views

how to display the data that is not duplicate using SQL

imagine I have two tables.the first is Film and the second is Store the store table has a store_id column and the value inside store_id are 1 and 2. the Film table has title_name of the movies. my ...
Mohammed's user avatar
1 vote
1 answer
732 views

Get Duplicate records from a table on combination of Multiple Columns and show 'Y' for Duplicate and 'N' for Single records

I need to find duplicate records from a table on combination of Multiple Columns and show 'Y' for duplicate records along with other columns in a gridView. To Illustrate : Table A: ID, Col1 , Col2, ...
Mufaddal's user avatar
  • 566
0 votes
1 answer
82 views

SQL - Join from Lookup Table - Roll-up Output file into Single Row vs Multiple Rows

I have a lookup table with fields: Item_ID, Item_ID_Description ID ID_Description 501 Horse 601 Mango 701 Trumpet 801 House 901 Cola I have a demographic table with fields: Name_ID, ...
TheDoc96's user avatar
-1 votes
2 answers
5k views

Violation of PRIMARY KEY constraint 'xx'. Cannot insert duplicate key in object 'cc'. The duplicate key is (x)

Updated question for better understanding and because I found the solution, I was looking for: My script goes like this: CREATE TABLE [dbo].[MyTable] ( [Columndata1] [nvarchar] (255) NOT NULL, ...
nelion's user avatar
  • 1,962
0 votes
1 answer
56 views

Find and Remove Duplicate Rows from a SQL Server Table

I'm using a SQL Server database and I have a datetime column datatype is datetime. Some rows under datetime column are duplicate, how can I delete the duplicate row and sort table by datetime? T-SQL: ...
williamfaith's user avatar
0 votes
1 answer
437 views

Pivoting duplicate data from rows to columns in SQL Server

I have a dataset with duplicate values due to number of feedback received for a particular candidate. There are 3 feedback types are Security, Others and Social. A candidate can have multiple of ...
RKKK's user avatar
  • 37
0 votes
2 answers
75 views

SQL Server 2016 - Inserting remaining rows into a table leading to duplicates of existing rows

I have 4 tables: People Status, People, Codes and PeopleStatusCodes with the following schemas: People: [ID] INT IDENTITY (1, 1) CONSTRAINT [PK_People_ID] PRIMARY KEY, [PersonCode] VARCHAR(...
mistaq's user avatar
  • 385
-1 votes
2 answers
291 views

Why is this SQL code sporadically producing orphaned records?

Disclaimer: I'm not a SQL expert. I'm trying to insert records into a child table before inserting them into the parent table. (After saying that I'm starting to wonder if this is even a good idea.) ...
KSwift87's user avatar
  • 2,232
1 vote
5 answers
99 views

Delete duplicate rows from a table and referenced table microsoft sql server

I have table Person : PersonId | FirstName | LastName | 1 | 'John' | 'Doe' | 2 | 'Mike' | 'Test' | 3 | 'John' | 'Doe' | 4 | '...
Mohammad Reza Shahrestani's user avatar
2 votes
3 answers
97 views

Update Item from same table where values are null

I have a table Member where their are duplicate entries and I want to remove one of them, but 1 of the entry has some columns updated and another has some other. So What I want to do is update but ...
Arijit Mukherjee's user avatar
0 votes
1 answer
29 views

I need to group 2 rows two 1 and concatenate values of one column in SQL SERVER 2008

so this is the situation,i have this table with multiple records but a few records have the same values with only one column being different ID NAME SELCODE RANGE 111 DANIEL 123123 YES 111 ...
Daniel Iglesias Valenzuela's user avatar

15 30 50 per page