I’m trying to implement a JOIN with two tables, but have stumbled upon a little problem.
I’ve got the following data structure:
Original table
ID – Name – Value
1 – John – Clerk
2 – Jack – Driver
Join table
ID – Name
1 – John
2 – Jack
3 – Matt
I need to join my tables so that the result will be the following:
Result
ID – Name – Value
1 – John – Clerk
2 – Jack – Driver
3 – Matt – null
So, I wrote the following statement SELECT * FROM original_table LEFT JOIN join_table ON original_table.ID GROUP BY join_table.ID
And it returns me the following result:
Result
ID – Name – Value
1 – John – Clerk
2 – Jack – Clerk
3 – Matt – Clerk
What should I fix in order to value column be ignored during the join?
Thank you.
Try the following,
SQLFiddle Demo