MySQL -How can I change the id to the username?

0

I am trying to make a query with the following 2 tables:


 ************          ***************
 * Usuarios *          * Seguidores  *
 ************          ***************
 * id       *          * id          *
 * username *          * user_id     *
 * password *          * follow_id   *
 ************          ***************

There is a relationship between the id column of the Users table with user_id and the follow_id of the Followers table

Making the following query:

SELECT u.id, u.username, s.follow_id FROM Seguidores AS s INNER JOIN Usuarios AS u ON s.user_id = u.id AND s.user_id = 'El id que asignare de la tabla usuarios' LIMIT 5

What I try to do is show me only the followers that match ('Users.id') with ('Followers.user_id') and instead of showing me the follower's id ('Followers.follow_id' ), show me your username ('Usuarios.username').

But I have no idea how to do that in the end, instead of showing me the follower id ('Followers.follow_id'), show me your username ('Usuarios.username).

I am a newbie in MySQL queries, I would appreciate it if you would give me a hand, thank you very much.

    
asked by swjmj94 25.08.2018 в 04:34
source

0 answers