I print the Id of one table and get the value 1 or 2 - it does not matter. I know that this value is the Id of the article creator. The question is how do I display the creator's nickname, knowing its id through mysql. The answer please in one line with finding the id from the posts table and later, for this id - nickname in another users table. The condition is that the id in posts is the same as id in users.

    1 answer 1

    SELECT nickname FROM users WHERE id IN (SELECT id FROM posts); 

    Read more about such things here: http://www.mysql.ru/docs/man/ANSI_diff_Sub-selects.html

    • Please try to publish detailed answers containing a specific example of the minimum solution, supplementing them with a link to the source. Answers –references (like comments) do not add knowledge to Runet. - Nicolas Chabanovsky