Answer the question
In order to leave comments, you need to log in
How to get field name from linked table?
Good day, I’m incredibly stupid in this matter.
There are 2 tables:
1) users
2) consts
and in that one there is a const_id by which they are connected, that is, in the users table, respectively, only const_id is output;
in the const table, all parameters for the user are stored as minimum name, etc.
when displaying data in foreach from the users table, I would like to display not const_id, but its name
Answer the question
In order to leave comments, you need to log in
SELECT users.*, const.name FROM users
LEFT JOIN const ON users.const_id = const.id
SELECT users.*, const.name const_name FROM users
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question