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

The Archive Base Latest Questions

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

This multiple SELECT QUERY runs consecutively. I need one report with multiple columns for

  • 0

This multiple SELECT QUERY runs consecutively. I need one report with multiple columns for [GBPMID] and [EURMID].

Query 1

SELECT
    (([askPrice] - [bidPrice]) / 2) + [bidPrice] AS [EURMID]
    FROM TicksForex 
        WHERE [Symbol] = 'EUR/USD' 
        AND [Time] >= CONVERT(datetime, '6/6/2011 12:00 AM')

Query 2

SELECT
     [Time]
    ,[askPrice]
    ,[bidPrice]
    ,(([askPrice] - [bidPrice]) / 2) + [bidPrice] AS [GBPMID]
    FROM TicksForex 
        WHERE [Symbol] = 'GBP/USD'  
        AND [Time] >= CONVERT(datetime, '6/6/2011 12:00 AM')

@Pranay & @Magnus – MY APOLOGIES! My Data tables do not share the same TIME Values… which was a surprise to me.. this is why the records do not line up.. so sorry!! I will run this as @Pranay describes below…

Forget it! It normalized the data (date) so they all shared the same date – ie.. updated prices at the same time.. and it still does not work!!

  • 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-22T22:14:43+00:00Added an answer on May 22, 2026 at 10:14 pm

    Make use of Case...when will resolve you issue easily

    SELECT
         [Time]
        ,[askPrice]
        ,[bidPrice],
    
      ( CASE WHEN Symbol = 
              'GBP/USD' THEN ((([askPrice] - [bidPrice]) / 2) + [bidPrice])
             ELSE 0
          END) AS [GBPMID],
      ( CASE WHEN Symbol =
               'EUR/USD' THEN ((([askPrice] - [bidPrice]) / 2) + [bidPrice])
             ELSE 0
          END) AS [EURMID]
    
        FROM TicksForex 
            WHERE ([Symbol] = 'GBP/USD'  or [Symbol] = 'EUR/USD' )
            AND [Time] >= CONVERT(datetime, '6/6/2011 12:00 AM')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to select multiple records I use SELECT * FROM `table` WHERE `ID`
I've used answer from this question: Django: making raw SQL query, passing multiple/repeated params?
I want select multiple (all) values from table Account. string query = SELECT *
Let us say I have a query like this: SELECT * FROM ( SELECT
I've got this nasty problem where sending multiple, large messages in quick succession from
Following on from this question: Run WCF ServiceHost with multiple contracts Are there any
I need to generate multiple random values under SQL Server 2005 and somehow this
I have a select query like this select count(distinct id)*100/totalcount as freq, count (distinct
I am writing a query which has multiple select statements in an insert statement
I have a query that runs multiple times a day, the issue though is

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.