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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:56:01+00:00 2026-06-10T13:56:01+00:00

I have a exchange rate table like below FromCurrency ToCurrency ValidFrom ExchangeRate USD ZAR

  • 0

I have a exchange rate table like below

FromCurrency    ToCurrency          ValidFrom               ExchangeRate
USD             ZAR         2012-01-05 00:00:00.000         7.7260000000
USD             ZAR         2012-01-04 00:00:00.000         7.6740000000
USD             ZAR         2012-01-03 00:00:00.000         7.4601000000
USD             ZAR         2012-01-02 00:00:00.000         7.7600000000
USD             ZAR         2012-01-01 00:00:00.000         8.0945000000
EUR             NOK         2012-01-05 00:00:00.000         7.5881000000
EUR             NOK         2012-01-04 00:00:00.000         7.5974000000
EUR             NOK         2012-01-03 00:00:00.000         7.4494000000
EUR             NOK         2012-01-02 00:00:00.000         7.6606000000
EUR             NOK         2012-01-01 00:00:00.000         7.7740000000
USD             AED         2012-01-05 00:00:00.000         3.6731000000
USD             AED         2012-01-04 00:00:00.000         3.6731000000

My main table is

Transaction Date    Amount  Currency    FromCurrency
13971   5/27/2011    8000     USD   USD
13971   7/31/2011   -6809.4   ZAR   USD
13971   8/30/2011   -425.59   ZAR   USD
13971   9/27/2011   -6809.4   ZAR   USD
67467   11/8/2011    5000     GBP   GBP
67467   12/21/2011  -5195.06  ZAR   GBP
67467   1/30/2012   -5195.06  ZAR   GBP
81181   4/15/2011    6000     USD   USD
81181   6/28/2011   -5159.03  ZAR   USD
82418   10/21/2011   5000     EUR   EUR
82418   1/27/2012   -3919.97  NOK   EUR

Above is sample data of table, my actual table has millions of records. I have to multiply amount with exchange rate column (from exchange rate table) and update the corresponding FromCurrency (from exchange rate table) with currency column in my table.

I have tried many ways but couldn’t find the solution. The tricky part here is there is not matching date for my table in exchange rate table.

Exchange rate should be applied like this. If my transaction date is Feb-20-2012 and Currency is ZAR and FromCurrency is USD then I have to pick the below row from exchange rate table

USD             ZAR         2012-01-02 00:00:00.000         7.7600000000
  • 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-06-10T13:56:02+00:00Added an answer on June 10, 2026 at 1:56 pm
    update transactions
    set FromCurrencyAmount = transactions.amount * 
        (select top 1 exchangerate from exchangerates where validfrom <= transactions.date 
           and transactions.fromcurrency = exchangerates.fromcurrency
           and transactions.currency = exchangerates.tocurrency
           order by validfrom desc) 
    

    To select

    select transactions.*, 
        (select top 1 exchangerate from exchangerates where validfrom <= transactions.date 
           and transactions.fromcurrency = exchangerates.fromcurrency
           and transactions.currency = exchangerates.tocurrency
           order by validfrom desc) 
    from transactions
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables like the ones below. I need to find what exchangeRate
I have an exchange rate table. I need to get current rate and previous
I have exchange rate table in which there are multiple date wise records with
I have an application where I would like to exchange information, managed via Core
I have a query that goes like this: SELECT Product.local_price*Rate.exchange_rate AS 'US_price' FROM Product
I have an $.ajax() request that queries currency exchange rate information from another web
I have a UserControl used for getting an exchange rate amount from user (bank
I am trying to get an exchange rate from the iGoogle Calculator. I have
I have a dataset showing the exchange rate of the Australian Dollar versus the
I have a method as follows: public decimal GetExchangeRate(string fromCurrency, string toCurrency) { GoogleCurrencyService

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.