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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:09:54+00:00 2026-06-16T01:09:54+00:00

I have 2 tables. One has order elements (OE) and one has project information(PO).

  • 0

I have 2 tables. One has order elements (OE) and one has project information(PO). There are many order elements to 1 project. The way the tables are set up, the project date is is in the PO and the Currency is in the OE. I need to update the Euro Exchange rate in the OE table. I am trying to do something like this

    UPDATE [OETest]
    SET [Euro Exchange Rate] = {
    CASE
        WHEN (DATEPART(month, PO.[Project Date Time]) = January)
        THEN 8.143296
        WHEN (DATEPART(month, PO.[Project Date Time]) = February)
        THEN 8.340111
    }
    FROM [POTest] PO, [OETest] OE       
    WHERE OE.[Currency] = 'YUAN'

But I am lost (This is one of many queries I have tried). Can anyone help me construct the necessary query and talk me through why it works?

This particular query is telling me there is Incorrect syntax near keyword CASE

To make it more clear what I am trying to accomplish: I have a column for the euro exchange rate in the OE table. I have the average monthly exchange rate that I obtained from a website (not in the table). I want to set this exchange rate column based on the month of the project and the currency. I am going to handle each currency in separate queries so the Yuan is the only currency I’m worried about for this query. The month is in the PO table. I need to use the month from the PO table in the case statement.

  • 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-16T01:09:56+00:00Added an answer on June 16, 2026 at 1:09 am
    UPDATE OE -- the alias here rather than the base table name
       SET [Euro Exchange Rate] = 8.143296
      FROM [POTest] PO
      JOIN [OETest] OE ON OE.project_id = PO.project_id -- you need a link       
     WHERE OE.[Currency] = 'YUAN'
        -- the following date range represents January this year
        AND PO.[Project Date Time] >= '20120101'
        AND PO.[Project Date Time] <  '20120201'
    

    You only need a case statement if you need different values depending on different dates

    UPDATE OE -- the alias here rather than the base table name
       SET [Euro Exchange Rate] =
           CASE Month(PO.[Project Date Time])
                when 1 then 8.143296
                when 2 then 7.143296
                when 3 then 7.743296
                END
      FROM [POTest] PO
      JOIN [OETest] OE ON OE.project_id = PO.project_id -- you need a link       
     WHERE OE.[Currency] = 'YUAN'
        -- the following date range represents 3 months this year
        AND PO.[Project Date Time] >= '20120101'
        AND PO.[Project Date Time] <  '20120401'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables with a one to many relation. One Order has many
I have two tables. One has order information with an order id, and the
I have a database with many tables and one particular table has columns: name
I have a DB with many tables and one of the table has fields:
I have a mysql database with two tables, its a one-to-many relationship. table1 has
Suppose I have two tables that are linked (one has a foreign key to
I have two tables. One has some product details, the other holds various photos
I have two tables, one that has 450 rows, the other is a Sort
I have two tables. One (Widgets) has a list of widgets (ID, widget_name, color,
I have two tables, one that has a foreign key from the other. I

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.