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

  • Home
  • SEARCH
  • 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 9218547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:53:23+00:00 2026-06-18T02:53:23+00:00

I have a log table where multiple rows have been included with ADD status

  • 0

I have a log table where multiple rows have been included with ADD status (“status = 0” means “add”).

How to remove status = 0 but it must be unrepeated value. For example each transaction id (tid) must have only one value with status = 0.

For example;

id tid       tblname           type     status 
1   101     x                   U              0
2   101     x                   U              0
3   102     x                   U              0
4   102     x                   U              0
5   102     x                   U              0

Must return:

id  tid     tblname       type           status 
1   101     x            U              0
3   102     x            U              0

How can I do that?

  • 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-06-18T02:53:24+00:00Added an answer on June 18, 2026 at 2:53 am

    With a cte and ROW_NUMBER:

    WITH x AS (SELECT rn = Row_number() 
                           OVER( 
                             partition BY tid 
                             ORDER BY id) 
             FROM   dbo.log
             WHERE  status = 0 
                    AND tblname = 'X' 
                    AND type = 'U') 
    DELETE FROM  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 a log table containing user ids, ip addresses and log in datetimes.
I have a table on my database called 'Log'. This Log table contains ID,
I have a table that contains log entries for a program I'm writing. I'm
I have a table that functions as an event log and stores the users
I have a log table, each row representing an object logging its state. Each
Performance consideration: Spread rows in multiple tables vs concentrate all rows in one table.
I have a time log table where all entries are entered with a time
Iam thinking changing the log file into database table. I execute multiple shell_exec and
I have a table with multiple products. For each product, I am collecting an
I have an sqlite table log that looks like this: ID p_id viewer ----------------------

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.