silent_coder14 silent_coder14 - 7 months ago 41
MySQL Question

MySQL Select all records

I have to tables: user and userimages.
enter image description here

Right now, I'm using the following query:

SELECT * FROM users u INNER JOIN userimages ui ON;

Yes. It retrieved the records if the userid and id is equal. What I really want to do is to select all records from table users even if its id is not present on the second table (userimages)

My question is how to select all records in the users table with or withou userid on the second table?


You're looking for a LEFT JOIN, which will pull all rows from the first table and join where applicable to the right.

SELECT *  FROM   users u LEFT JOIN userimages ui ON;