I am trying following query to show all of my user at user page...
SELECT u.id, u.username, u.email, u.active, u.admin, u.team_id, t.name AS team_name, sum( s.score ) AS total_score FROM users u INNER JOIN teams t ON u.team_id = t.id INNER JOIN stats s ON u.id = s.user_id I have 4 users in my users table and i want to list all but if i use INNER JOIN, its returning only 1 row. Check data structure as following...
| id | game | user_id | rank | score | dnt | +----+------+---------+-------+------+-----+ | 1 | test | 5 | 2 | 2200 | +--------+----------+----------+-----+-----+ | 2 | test | 3 | 1 | 2500 | +--------+----------+----------+-----+-----+ teams
| id | name | dnt | +----+-------+-----+ | 1 | team1 | | +----+-------+-----+ | 2 | team2 | | +----+-------+-----+ users
| id | username | email | team_id | +----+----------+-------+---------+ | 1 | user1 | | 1 | +----+----------+-------+---------+ | 1 | user2 | | 2 | +----+----------+-------+---------+
user1anduser2both haveidequal1?