简体   繁体   中英

How to query a row in MYSQL and join results to a row from another table?

SELECT DISTINCT a.userID, buildstatus
FROM meeting a
WHERE buildStatus =  'complete'
INNER JOIN user.contactName ON (a.userID = b.userID)

Ok so I'm trying to join these two tables where buildstatus from the meeting table is found to be complete it will then find the user id from the user table and join the contact name to this query.

Unfortunately, whatever I try seems to throw up an error message.

Any ideas how to solve this issue?

The order of the query clauses have to be correct. switch join and where

SELECT DISTINCT a.userID, a.buildstatus 
FROM meeting a
INNER JOIN `user` b ON a.userID = b.userID
WHERE a.buildStatus = 'complete' 

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