简体   繁体   中英

PHP MySQL join table

$sql = "SELECT logs.full_name, logout.status FROM logs, logout WHERE logs.employee_id = logout.employee_id";
tables --> logs
           logout

I'm having error on this. I search join tables in google. And that's what I got. What is wrong with this code?

I don't see a "JOIN" anywhere in your query.

The correct syntax:

SELECT logs.full_name, logout.status FROM logs
    LEFT JOIN logout ON (logs.employee_id = logout.employee_id);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM