MySQL: Select remaining rows

Posted by Bjork24 on Stack Overflow See other posts from Stack Overflow or by Bjork24
Published on 2010-03-18T22:41:12Z Indexed on 2010/03/18 22:51 UTC
Read the original article Hit count: 104

Filed under:
|
|

I've searched everywhere for this, but I can't seem to find a solution. Perhaps I'm using the wrong terms. Either way, I'm turning to good ol' trusty S.O. to help my find the answer.

I have two tables, we'll call them 'tools' and 'installs'

tools = id, name, version
installs = id, tool_id, user_id

The 'tools' table records available tools, which are then installed by a user and recorded in the 'installs' table. Selecting the installed tools are simple enough:

SELECT tools.name
  FROM tools
  LEFT JOIN installs
  ON tools.id = installs.tool_id
  WHERE user_id = 99 ;

How do I select the remaining tools -- the ones that have yet to be installed by user #99?

I'm sorry if this is painfully obvious, but I just can't seem to figure it out! Thanks for the help!

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql