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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:34:31+00:00 2026-05-20T04:34:31+00:00

I have two tables (Master, Responses) I need use the Master_Id field from the

  • 0

I have two tables (Master, Responses)

I need use the Master_Id field from the Responses table, to look it up in Master table (id) for matching record and update a date field in the Master table with a date field in the Responses table

Master Table’s Id field links to Reponses table’s Master_id field

Can this be done in SQL ????

UPDATE Master m SET m.date = (
     SELECT r.date FROM Reponses r WHERE r.master_id = m.id)  
WHERE m.id IN (SELECT master_id FROM Responses) 

I get a – General SQL Error – Multiple rows in singleton select.

Do i need to add a join or change something?

  • 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-20T04:34:32+00:00Added an answer on May 20, 2026 at 4:34 am

    The error means there are some cases where one particular master record have more than one Response, the sub-query to get the date returns more than one row. As you might know, the server does not have the logic to pick the correct response and update the master table (the dates may be different or not, who knows), so shows the error message.

    What you have to do is to ensure the sub query returns only one row: the exact one row you require to pick the response date on the master table. If all response rows contains the same date, you can use the FIRST clause to return just the first row, as suggested by @cyberkiwi.

    But you may want to pick the newest, the oldest or any other based on a criteria:

    All this will suppress the error message, the correct one may not be sown, depending on your needs:

    UPDATE Master m SET m.date = (
         SELECT FIRST 1 r.date FROM Reponses r WHERE r.master_id = m.id)  
    WHERE m.id IN (SELECT master_id FROM Responses) 
    
    UPDATE Master m SET m.date = (
         SELECT MAX(r.date) FROM Reponses r WHERE r.master_id = m.id)  
    WHERE m.id IN (SELECT master_id FROM Responses) 
    
    UPDATE Master m SET m.date = (
         SELECT MIN(r.date) FROM Reponses r WHERE r.master_id = m.id)  
    WHERE m.id IN (SELECT master_id FROM Responses) 
    
    UPDATE Master m SET m.date = (
         SELECT r.date FROM Reponses r WHERE r.master_id = m.id AND r.accepted = 1)  
    WHERE m.id IN (SELECT master_id FROM Responses) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've two master tables Org & Item and then there's an OrgItem table.I have
I have two tables nested (master view) for representing my data. The parent table
I have two tables: P and PC (master/detail joined by the column Id) Table
I have two tables that need to be updated, Master and Identifiers: Master --MasterID
so I have two tables. They are pictured below. I have a master table
I have two tables Master Detail In the Master & Detail table I get
I have two tables Master Detail In the Master & Detail table, i have
I have two tables as shown below The master Table ID keyword_tags ----------- ---------------------------------------------
I have two large tables -Master table A: 1.4million rows -Detail table B: 9
I have two tables, one having 60 lacs record serving as master data. Another

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.