Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Left Join Single Field

Currently I am joining the 'articles' table with 'users' table. Instead of joining all fields from the 'users' table, I just want to join the field 'fullName'.

Is this possible? I've been searching for a solution but haven't had much luck. This is my SQL statment currently:

SELECT * FROM articles LEFT JOIN users ON articles.uid=users.uid

Thanks

like image 829
hollandben Avatar asked Dec 28 '25 15:12

hollandben


1 Answers

Just change * to the list of wanted columns

SELECT 
    articles.*, 
    users.fullName 
FROM 
    articles 
LEFT JOIN users ON articles.uid=users.uid
like image 92
Martin. Avatar answered Dec 31 '25 05:12

Martin.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!