Hi all -- I just need a quick sanity check on a query.
I have two tables: CREATE TABLE users ( userID VARCHAR(10) NOT NULL PRIMARY KEY, [many other fields] ) CREATE TABLE subscriptions ( userID VARCHAR(10) NOT NULL, listID INT NOT NULL ) In these tables, users.userID == subscriptions.userID. The users table keeps 1 record per userID, and the subscriptions table keep multiple records per userID (one for each listID to which they're subscribed). If I wanted to select all users from the users table that *do not* appear in the subscriptions table, I'd want the following query: SELECT users.* FROM users LEFT JOIN subscriptions ON users.userID=subscriptions.userID WHERE subscriptions.userID IS NULL Correct? I know that this is a pretty base example, but I'd like to confirm it (outside of an example in a book) with someone a bit more knowledgable than me. There are a couple other reports here that calculate this number in other ways, and I'd like to be able to positively state that this is the be-all end-all for the needed data. Much thanks! -- denonymous www.coldcircuit.net denonymous.ne.mediaone.net --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php