A
A
assx642017-02-01 16:15:03
MySQL
assx64, 2017-02-01 16:15:03

How to create a MySQL query from two tables?

5f7c6ae349cb4c31a24250c1cb76252b.jpg
It is necessary to make a calculation according to the formula $x = (w * efr) / rft * (1 + (cos / 10):. And put the data in 'result'.
It is quite simple to make a calculation from one table, but I can’t figure out how to take data from the second one.
I would be very grateful for your help in making a request.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Eugene, 2017-02-01
@assx64

UPDATE Prod SET result = w*eft/(SELECT Forc.rft * (1 + Forc.cos / 10) from Forc where Forc.id=Prod.id)

R
Rsa97, 2017-02-01
@Rsa97

JOIN on a common field

A
Anton, 2017-02-01
@MoonMaster

Join to help you. Join two tables by key field, in your case ID

F
Finsh, 2017-02-01
@Finsh

SELECT * FROM forc LEFT JOIN prod ON prod.id = forc.id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question