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 7582083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:21:07+00:00 2026-05-30T18:21:07+00:00

TableA ( id int, batch char(15), mode char(10), match2 char(15), status char(15) ) ID

  • 0

TableA (id int, batch char(15), mode char(10), match2 char(15), status char(15))

ID Match  MODE  match2 STATUS
1  ABC12   A     123
2  ABC12   A     123
3  ABC12   A     123
4  ABC12   B     234
5  ABC12   B     234
6  BCD32   A     456
7  BCD32   B     456

So, I need to populate Status with ‘PASS’ where mode = ‘B’ and

  1. For same match, if its corresponding mode A (ID1,2,3) if we talk about ABC12, It has different Match2.

So ID 4 and 5 will get “PASS”.

Thanks in advance.

  • 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-30T18:21:08+00:00Added an answer on May 30, 2026 at 6:21 pm

    Try the following:

    CREATE TABLE TableA (id int, match char(15), mode char(10),match2 char(15), status char(15))
    
    
    INSERT INTO TableA (ID, Match,  MODE,  match2)
    SELECT 1,  'ABC12',   'A',     123 UNION
    SELECT 2,  'ABC12',   'A',     123 UNION
    SELECT 3,  'ABC12',   'A',     123 UNION
    SELECT 4,  'ABC12',   'B',     234 UNION
    SELECT 5,  'ABC12',   'B',     234 UNION
    SELECT 6,  'BCD32',   'A',     456 UNION
    SELECT 7,  'BCD32',   'B',     456 UNION
    SELECT 8,  'ABC23',   'A',     NULL UNION
    SELECT 9,  'ABC23',   'B',     789
    
    
    UPDATE
        t1
    SET
        status = 'PASS'
    FROM
        TableA AS t1
    JOIN
        TableA AS t2
    ON
        t1.id != t2.id
    AND t1.match = t2.match
    AND (t1.match2 != t2.match2 OR t2.match2 IS NULL)
    AND t2.mode = 'A'
    WHERE
        t1.mode = 'B'
    
    SELECT * FROM TableA
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: TableA ( ID [int, pk], Name [string]) and TableB (ID
I have the following table structure ZoneID int ZoneName varchar(50) I need to get
Below is pseudo-code for SQL Server stored procedure I need to write: int[] followers
I have 2 tables: TableA ------ TableAID INT IDENTITY Primary Key TableBID INT NULL
I have a query where I need to batch insert rows into a table
I have SQL Server tables as follows: create table TableA ( id int primary
Table structure- int PrimaryKey DateTime Date int Price What I would like to do
The Table: declare @Table table ( id int, ticketid int, sponsor int, dev int,
Here is my table: id int(11) name varchar(255) description text highest_bidder int(11) value varchar(255)
Given the following: declare @a table ( pkid int, value int ) declare @b

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.