I need to remove duplicate values SQL Left Join My SQL code:

SELECT
users.id,
users.username,
job.category,
locations.location
FROM users
INNER JOIN job ON users.username = job.username
INNER JOIN locations ON job.username = locations.username


Results:

5   Don   Fashion/Design/Beauty         Mr
5   Don   Eng                           Mr
5   Don   Arts/Audio/Video Technology   Mr
5   Don   Fashion/Design/Beauty         Colombo
5   Don   Eng                           Colombo
5   Don   Arts/Audio/Video Technology   Colombo
5   Don   Fashion/Design/Beauty         gm
5   Don   Eng                           gm
5   Don   Arts/Audio/Video Technology   gm


I need to remove those 6 duplicate results in SQL to get the below results. Please kindly help me to figure out this.

5   Don   Fashion/Design/Beauty         Mr
5   Don   Eng                           Colombo
5   Don   Arts/Audio/Video Technology   gm
It is not possible to display in the format you want (without a lot of extra work and an assumption that there are always as many locations as job categories.)

Using GROUP_CONCAT however will allow you to return 1 row per username which contains all the information you seek, regardless of the number of job categories and locations.

SELECT
users.id,
users.username,
GROUP_CONCAT(job.category) AS job_categories,
GROUP_CONCAT(locations.location) AS locations
FROM users
INNER JOIN job ON users.username = job.username
INNER JOIN locations ON job.username = locations.username
GROUP BY users.id


It will return results like:

5   Don   Fashion/Design/Beauty,Eng,Arts/Audio/Video Technology        Mr,Colombo,gm