A
A
Alexander Bondarenko2020-02-12 16:09:18
MySQL
Alexander Bondarenko, 2020-02-12 16:09:18

How to correctly access a table field in a database?

UPDATE Test SET second_name = Second_name.id WHERE Test.second_name = second_name.Second_name;

I have a database update request but it fails, an error occurs
Unknown column 'second_name.Second_name' in 'where clause'

While the second_name field exists in the second_name table.
How can this be fixed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Yakovenko, 2020-02-12
@bond_1013

If I understood the query correctly, then you are trying to put a value from another table. Then the question is, why don't you join with the Second_name table by condition in the where clause?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question