kigogu Posted April 17, 2012 Share Posted April 17, 2012 I have a query like, SELECT * FROM account_duplicate WHERE id = account.id AND account.found = 0 AND account.name LIKE %something% What I want to do is select all the entries from the account_duplicate table where the id equals the id from the account table, the found value from the account table is equal to 0 and the name of the account is similar to "some name" I am new to mysql so I am not sure how I might be able to do this lol I know it is probably something simple but any help would be appreciated ^^ Quote Link to comment https://forums.phpfreaks.com/topic/261125-mysql-query/ Share on other sites More sharing options...
kigogu Posted April 17, 2012 Author Share Posted April 17, 2012 Alright! I have found the answer, after searching forever. I just ended up doing a LEFT JOIN so my query ended up being: SELECT * FROM account_duplicate LEFT JOIN account ON account_duplicate.id = account.id WHERE account.found = 0 AND account.name LIKE '%something%' is this an alright result to go? no one really has to answer this, its only for more understanding, but as far as my original question is concerned it has been answered Quote Link to comment https://forums.phpfreaks.com/topic/261125-mysql-query/#findComment-1338209 Share on other sites More sharing options...
fenway Posted April 21, 2012 Share Posted April 21, 2012 You want INNER JOIN, not LEFT JOIN, since you require a match in both tables. Quote Link to comment https://forums.phpfreaks.com/topic/261125-mysql-query/#findComment-1339313 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.