benf101
02-22-2009, 05:52 PM
Sorry if that title didn't make sense... it was the best way I could describe it.
I must have a fundamental misunderstanding of joins because my query is just returning everything except what I'm looking for.
I have 2 tables.
usersRss:
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| username | varchar(50) | NO | PRI | | |
| rssID | int(11) | NO | PRI | 0 | |
+----------+-------------+------+-----+---------+-------+
and rssSources;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| source | varchar(255) | YES | | NULL | |
| description | varchar(255) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
I want to get the RSS sources whose ID is NOT in the usersRss table. I THOUGHT that meant to do an "outer" join. Apparently, I'm wrong.
Correct me where I'm wrong:
SELECT *
FROM usersRss OUTER JOIN rssSources
on usersRss.rssID = rssSources.id
WHERE usersRss.username = '$username';
I've tried left, right, outer, and every other combo I can think of. Any suggestions?
I must have a fundamental misunderstanding of joins because my query is just returning everything except what I'm looking for.
I have 2 tables.
usersRss:
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| username | varchar(50) | NO | PRI | | |
| rssID | int(11) | NO | PRI | 0 | |
+----------+-------------+------+-----+---------+-------+
and rssSources;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| source | varchar(255) | YES | | NULL | |
| description | varchar(255) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
I want to get the RSS sources whose ID is NOT in the usersRss table. I THOUGHT that meant to do an "outer" join. Apparently, I'm wrong.
Correct me where I'm wrong:
SELECT *
FROM usersRss OUTER JOIN rssSources
on usersRss.rssID = rssSources.id
WHERE usersRss.username = '$username';
I've tried left, right, outer, and every other combo I can think of. Any suggestions?