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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:02:31+00:00 2026-05-23T12:02:31+00:00

Revised Query.. the [Id] column is unique to all records.. the query should return

  • 0

Revised Query.. the [Id] column is unique to all records.. the query should return the correct value for CorEURUSD to both Symbol = EURUSD and Symbol = GBPUSD where the [Time] = [Time] values.

 CREATE TABLE [dbo].[Tck2](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Symbol] [varchar](35) NULL,
[Time] [datetime] NULL,
[CorEURUSD] [decimal](14, 10) NULL,
[CorEURUSD2] [decimal](14, 10) NULL
  ) ON [PRIMARY]


 INSERT [VT7STAB1].[dbo].[Tck2] ([Symbol],[Time],[CorEURUSD],[CorEURUSD2]) VALUES('EUR/USD', '2011-07-01 12:04:28.000', 0.8229, 0.6488)
 INSERT [VT7STAB1].[dbo].[Tck2] ([Symbol],[Time],[CorEURUSD],[CorEURUSD2]) VALUES('EUR/USD', '2011-07-01 12:26:17.000', 0.9427, 0.6558)
 INSERT [VT7STAB1].[dbo].[Tck2] ([Symbol],[Time],[CorEURUSD],[CorEURUSD2]) VALUES('EUR/USD', '2011-07-01 12:58:34.000', 0.7713, 0.5267)
 INSERT [VT7STAB1].[dbo].[Tck2] ([Symbol],[Time],[CorEURUSD],[CorEURUSD2]) VALUES('GBP/USD', '2011-07-01 12:04:28.000', 0, 0)
 INSERT [VT7STAB1].[dbo].[Tck2] ([Symbol],[Time],[CorEURUSD],[CorEURUSD2]) VALUES('GBP/USD', '2011-07-01 12:26:17.000', 0, 0)
 INSERT [VT7STAB1].[dbo].[Tck2] ([Symbol],[Time],[CorEURUSD],[CorEURUSD2]) VALUES('GBP/USD', '2011-07-01 12:58:34.000', 0, 0)

Running the following query in an attempt to copy the CorEURUSD column from Symbol – ‘EUR/USD’ into the resulting CorEURUSD column for Symbol = ‘GBP/USD

update Tck2
set CorEURUSD = (
     select CorEURUSD
     from Tck2 T 
     where Symbol = 'EUR/USD')
 where Symbol = 'GBP/USD'

gave this error
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.

and when I used this revision..

update Tck2
set CorEURUSD = (
     select CorEURUSD
     from Tck2 T 
     where Symbol = 'EUR/USD')
 where Symbol = 'GBP/USD'
 and T.[Time] = [Time]

It throws this error.

Msg 4104, Level 16, State 1, Line 2
The multi-part identifier “T.Time” could not be bound.

I hope that is better, sorry for the ‘mass-confusion’ please revise answers to match the above query and table which should be correct.

  • 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-23T12:02:31+00:00Added an answer on May 23, 2026 at 12:02 pm

    Just a guess based on loose specs and no sample data / desired results.

    UPDATE t
        SET t.[CorEURUSD] = x.[CorEURUSD] 
        FROM dbo.TicksForex AS t
        INNER JOIN dbo.TicksForex AS x
        ON t.[id] = x.[id]
        WHERE 
            t.[Symbol] = 'GBP/USD'
            AND x.[Symbol] = 'EUR/USD';
    

    EDIT 2011-07-03
    Based on revised specs. Is [Time] really going to be your key for this type of update? Sounds risky. Anyway, since [Time] was the only way I could determine to join two rows based on your narrative and sample data, here is what I assume you mean (and I can also assume you only want to update CorEURUSD and not CorEURUSD2):

    UPDATE t
        SET t.[CorEURUSD] = x.[CorEURUSD]
        FROM dbo.Tck2 AS t
        INNER JOIN dbo.Tck2 AS x
        ON t.[Time] = x.[Time]
        WHERE t.Symbol = 'GBP/USD'
        AND x.Symbol = 'EUR/USD';
    

    Really wasn’t that much of a modification really, I merely changed the join condition.

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

Sidebar

Related Questions

-- All of the revised code still refuses to run well, please help --
REVISED: Okay, thanks to all of your input, I figured out what I was
Revised Code jQuery(function($) { $(#filter).keyup(function () { var filter = $(this).val(), count = 0;
REVISED QUESTION : We have tracked this down to a custom add to cart
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
I'm trying to execute the following query but I receive a runtime error stating
I am trying to create a LINQ to SQL query and am really stumped.
A while ago I posted a message about optimizing a query in MySQL. I
I have a function runAjax that functions correctly. Unfortunately I am struggling to return
[revised] I'm creating a TreePanel in ExtJs that is loading its children from a

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.