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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:14:44+00:00 2026-05-25T22:14:44+00:00

I have two tables: ( ID = int, Match = varchar, Status = char

  • 0

I have two tables: (ID = int, Match = varchar, Status = char)

TableA

ID1 Match1 Status1
23  1200   PASS
24  1300   FAIL
25  1400   PASS
26  1500   PASS
27  1600   FAIL

TableB

ID2 Match2 Status2
456 1200
784 1300
457 1300
124 1400
741 1600

Now, I want to populate tableB (status2) with ‘FAIL’ where there is fail in tableA (match).
so, I should get:

TableB
ID2 Match2 Status2
456 1200   NULL
784 1300   FAIL
457 1300   FAIL
124 1400   NULL
741 1600   FAIL

now this is pretty simple. I want to put in status2, ID1 which caused the fail so the expected result would be:

TableB
ID2 Match2 Status2
456 1200   NULL
784 1300   FAIL of ID 24
457 1300   FAIL of ID 24
124 1400   NULL
741 1600   FAIL of ID 27

I am currently using simple update statement as follows:

update B
set status2 = 'Fail'
from tableB B
Inner join tableA A
on a.match1 = b.match2
where a.status1 = 'FAIL'

Please correct to point to the ID1.

Thanks

  • 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-25T22:14:45+00:00Added an answer on May 25, 2026 at 10:14 pm
    update B
    set status2 = 'Fail of ID ' + CAST(A.ID1 AS VARCHAR(4))
    from tableB B
    Inner join tableA A
    on a.match1 = b.match2
    where a.status1 = 'FAIL'
    
    • 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, Match1 char, Match2 char, status char
Lets say I have two tables tblA ( tableAID INT IDENTITY(1,1), foo VARCHAR(100)) tblB
I have those two tables: client: id (int) #PK name (varchar) client_category: id (int)
I have two tables. table_x: id INT(11) tag INT(11) table_tags: id INT(11) name VARCHAR(255)
I have two tables in the DB FuelStation (fuel_station_id: int (PK), fuel_station_name: varchar, fuel_brand_id:
I basically have two tables: A(id int, name varchar(10), info varchar(10)) B(id int, item
I have two tables: Unit: UnitId int PK Title varchar UnitOption: UnitOptionId int PK
Imagine I have two tables. Document int DocumentId (PK) char DocumentName Attribute int DocumentId
I have two tables: Application applicationid (int) applicationname (varchar) isavailable (bit) and Holidays applicationid
I have two tables:- Table_01 Table01ID (int) TestID (uniqueidentifier) TestDate (Datetime) TestNo (varchar) Table_02

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.