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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:14:14+00:00 2026-05-30T16:14:14+00:00

I am having trouble writing a sql query and I was hoping that someone

  • 0

I am having trouble writing a sql query and I was hoping that someone may be able to help me out.
Here’s what I want my query to do:

  1. Take the “prod_value” column from the “product” table
  2. Multiply a constant (assume the number 2) times the “worth” column on the “value” table that corresponds to the one-to-one relationship between value <-> product.
  3. Update the “prod_value” column in the “product” table to the new updated value.

For example…
Here’s the tables:
value

  id     |      worth       |     product_id     |
   1     |         10       |         1          |

product (before)

   id    |     name        |        prod_value    |
   1     |    product1     |           100        |

and assume constant = 2.

Then what I want after I run the query is the following:

product (after)

   id    |     name        |        prod_value    |
   1     |    product1     |           120        |

The 120 comes from 100 (previous value) + 2*10

I was hoping to have this done with one single query, is this even possible?
If anyone can help me I would be very grateful!
Thanks 🙂

  • 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-30T16:14:15+00:00Added an answer on May 30, 2026 at 4:14 pm
    UPDATE `product`
    INNER JOIN `value` ON `product`.`id`= `value`.`product_id`
    SET `product`.`prod_value` = `product`.`prod_value` + 2* `value`.`worth`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I writing a query within ms sql server 2005 and having some trouble getting
I'm having some trouble writing a query using variables. Here's my code Dim bondnumber
I'm having trouble writing a query. I have a support tabled called 'MYTABLE' and
I am having trouble writing a query and I don't even know if it
I am having trouble writing C++ code that uses a header file designed for
I am having trouble writing a query on a mysql table of user activity
I'm using SQL Server MS. I'm having trouble writing this script: CREATE VIEW rental_view
I'm having a bit of trouble writing an sql for this scenario. For example
I'm having trouble writing a unit test for one of my controller actions. Here's
I am having trouble writing a rule for following problem in .htaccess. Here 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.