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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:31:52+00:00 2026-05-25T01:31:52+00:00

First of all I’m rather new to SQL and so even though I believe

  • 0

First of all I’m rather new to SQL and so even though I believe a similar question was asked in this thread ( SQL Query – Copy Values in Same Table ) I literally can’t understand it well enough to utilize the information. For that I apologize.

Now, I have a table that looks something like this:

company id | parameter name | parameter title
     P     | Parameter One  | First Parameter
     P     | Parameter Two  | Second Parameter
     P     | Parameter Three| Third Parameter
     W     | Parameter One  | NULL
     W     | Parameter Two  | NULL

Except that my table obviously has quite a lot of rows. I already went through filling in all the parameter titles where the company id was ‘P’ and would like to avoid manually doing the same for those with company id ‘W’. My question is what SQL statement (this is in Microsoft SQL Server 2008) can I use to copy the values in the column “parameter title” where the company id is ‘P’ to the values in the same column where the company id is ‘W’ and both parameter names match up (W has less parameters than P)?

Using the previously linked thread I was able to come up with the following, but it spits out an error and I know it’s not done correctly:

 UPDATE COMP_PARAMETER_COPY
 SET PARAM_TITLE=(SELECT PARAM_TITLE FROM COMP_PARAMETER_COPY P
             WHERE P.COMP_ID = 'P' AND P.PARAM_TITLE=PARAM_TITLE)
 WHERE COMP_ID='W'

(I’m playing around with a copy of the table instead of the actual table)

The error I get is “Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.”

Thank you for your help and advice,
-Asaf

  • 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-25T01:31:53+00:00Added an answer on May 25, 2026 at 1:31 am

    You need to ensure that your subquery is only returning one result. Right now that error message is telling you that you’re getting more than one record returned.

    UPDATE W
    SET PARAM_TITLE =   (
                            SELECT PARAM_TITLE FROM COMP_PARAMETER_COPY P 
                            WHERE P.COMP_ID = 'P' AND P.PARAM_NAME = W.PARAM_NAME
                        )
    FROM COMP_PARAMETER_COPY W
    WHERE W.COMP_ID = 'W'
    

    Try giving the above SQL a whirl. This could still give you more than one result, but without knowing what your table looks like and what the data constraints are it’s hard to give you something guaranteed to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I know I asked a similar question before but this one
First of all, my table structure is something similar like this: CREATE TABLE Testing(
First of all, I am sorry if this question doesn't belong to SO since
First of all there is a partial question regarding this, but it is not
First of all Sorry if my question title sounds stupid.... I have the following
First of all, I don't know if this should stay in SO or go
First of all, I got this huge xml file that represents data collected by
first of all, I'd like to explain why i need this. i need to
first of all sorry for the title. I know this is not so clear
First of all, forgive me, as my question may seem foolish, but I'm really

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.