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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:04:28+00:00 2026-05-27T14:04:28+00:00

I would like to show several columns from the orders table, one of which

  • 0

I would like to show several columns from the orders table, one of which is derived showing GBP order prices which have been converted using an exchange rate in another table. The exchange rate itself is dependent on two other columns in the orders table.

The 2 tables are:

TABLE `orders`
`id` 
`customer` 
`season_id`
`order_id`
`style_id`
`quantity`
'currency'
`order_price`

TABLE `forex`
`id`
`currency`
`season_id` 
`rate`

currency | season_id | rate 
 USD     |  W2012    | 1.5600   
 USD     |  S2012    | 1.5100   
 EUR     |  W2012    | 1.1510       
 EUR     |  S2012    | 1.1800       
 CAD     |  S2012    | 1.4600   
 CAD     |  S2012    | 1.5010       

I need to convert order_price (orders table) to a GBP order price using the appropriate exchange rate (rate in forex table) which depends on the currency type (e.g. USD, EUR – currency in the orders table) and varies with season (e.g. Winter, Spring – season_id in the orders table)

So the echo of the orders table to the browser should look something like:

customer|season_id  |style_id|quantity|currency|order_price|rate    |price GBP|
USA     |W2012      |6200    |2,550   |USD     |35,000     |1.5600  |22,436   |
Germany |W2012      |6200    |3,000   |EUR     |45,000     |1.1510  |39,096   |
Germany |S2012      |7220    |5,000   |EUR     |55,000     |1.1650  |47,210   |

So the statement would be along the lines of: show the exchange rate from the exchange_rate table which corresponds to the season_id and currency in the orders table.

How do I get the correct exchange rate in the select statement to be able to show the GBP order price alongside the other columns?

Apologies for messy explanation, still quite green in this area but boy do I want to learn more!

Thanks,
Derek.

  • 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-27T14:04:28+00:00Added an answer on May 27, 2026 at 2:04 pm
    SELECT o.customer, 
    o.season_id, 
    o.style_id, 
    o.quantity, 
    o.currency
    o.order_price, 
    o.rate,  
    round(o.order_price/f.rate) as "price GBP"  <-- assuming you need a round figure
    from orders as o
    inner join forex as f
    on o.season_id = f.season_id
    and o.currency = f.currency
    

    Between, mysql does not have a native support for currency format 12,300,
    if you require that, it will need some extra processing to format the string / numbe.

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

Sidebar

Related Questions

I have several images which I would like to show the user with Python.
I would like to use one Activity which holds several fragments and navigate among
I have several Div's that appear and would like each one to have a
I'm using Mongoid::Versioning which works great except that I would like to prevent several
I have a PHP Script which has several text areas. What I would like
In one of my columns I have a List that I would like to
I would like to toggle (hide/show) several elements of my web page. All those
I have a Visiblox chart showing several LineSeries . I would like to be
I would like to show the value of a variable in a TextView, like
I would like to show and hide a div during hover and hover out.

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.