
July 26th, 2007, 02:51 PM
|
|
Registered User
|
|
Join Date: Jul 2007
Location: Redmond Area
Posts: 1
Time spent in forums: 15 m 11 sec
Reputation Power: 0
|
|
|
Basic join problem (newbie)
Two tables: Category, and Topics.
I need a query to return all rows from the Category table and its related Topics. A row should be returned even when a category does not have a related Topic row. Seems simple enough.
SELECT Category.CategoryID, Topics.Title
FROM
Category LEFT OUTER JOIN
Topics ON Category.CategoryID = Topics.CategoryID
WHERE (Topics.DefaultStoryID = 10)
ORDER BY Category.CategoryID
It works in MS Access, but I can't get it to work in MSSQL for the life of me, regardless of the types of join I use. Only Category rows with at least one matching Topic are returned. I don't have a lot of hair anymore, but what's left is going fast. Any help is appreciated.
|