Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7534043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:54:05+00:00 2026-05-30T05:54:05+00:00

I have the below table CatItemLink with the records in it: ID CatID ItemID

  • 0

I have the below table CatItemLink with the records in it:

ID                                      CatID                                   ItemID
--------------------------------------------------------------------------------------------------------------------
ADBFBEFE-11F4-4CF0-A889-BBC9358CCF57    A411277E-0873-4323-B016-63F4DFA664C2    B66A47DF-A0E3-4D41-88E9-0B0CB27085D7
->E212A458-E5E2-4D77-B618-425082CFD8D2  A411277E-0873-4323-B016-63F4DFA664C2    B66A47DF-A0E3-4D41-88E9-0B0CB27085D7

D071B1C1-7296-4BCA-8AD3-8495704BF679    A411277E-0873-4323-B016-63F4DFA664C2    E288327C-15BF-4B01-BD37-0B6AD5365966
->B4F59516-2D85-4E2A-8FE4-3EDA27C3DA4F  A411277E-0873-4323-B016-63F4DFA664C2    E288327C-15BF-4B01-BD37-0B6AD5365966
->F3FB6BA5-79EC-4FC5-899E-24FA9F8DFF25  A411277E-0873-4323-B016-63F4DFA664C2    E288327C-15BF-4B01-BD37-0B6AD5365966

CF3FBD01-4445-4A72-AD1A-BF397970AEFC    BFB76F3D-4F06-4200-925D-1968666741A3    E288327C-15BF-4B01-BD37-0B6AD5365966

ID is a primary key. [CatID,ItemID] should have been a unique index, but the DBO did not specify that index. How to delete/select the records marked with -> meaning there will be only one ItemID per CatID.
(ItemID can be found with different CatID and this is ok).

I have a solution that uses SET ROWCOUNT but I want to have an alternative.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:54:09+00:00Added an answer on May 30, 2026 at 5:54 am
    ;WITH x AS 
    ( 
      SELECT ID, rn = ROW_NUMBER() OVER 
      (PARTITION BY CatID, ItemID ORDER BY ID)
      FROM dbo.CatItemLink
    )
    DELETE x WHERE rn > 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below order table,i want to retrieve records those are not in order
I have the below table with the below records in it create table employee
I have the below table. I am trying to get tbody column bgcolors matching
I have a table like below: Table A ---------- ID Field1 Field2 Field3 1
i have the table below <tr id=group_1>...</tr> <tr id=el>...</tr> <tr id=el>...<tr> <tr id=group_2></tr> <tr
I have a Generic List object which hold below table as its own value.
I have a mysql database with a table structure like below : Table Name
Below I have table - Company id name value year 1 IBM 10 2011
I have the below column on my table what gets binded on pageload, the
I have an SQL table defined as below: CREATE TABLE [TestComposite] ( ID int,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.