Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Left outer join returns results like inner join?

1 view
Skip to first unread message

Jon

unread,
Jul 20, 2010, 5:50:18 AM7/20/10
to
I'm really struggling with a query:

SELECT TOP (100) PERCENT dbo.tblBlogCategories.blogCategoryName,
COUNT(dbo.tblBlogCounter.blogCounterID) AS Count,
dbo.tblBlogCategories.blogCategoryID,
dbo.tblBlogCategories.blogViewType
FROM dbo.tblBlogCategories LEFT OUTER JOIN
dbo.tblBlogCounter ON
dbo.tblBlogCategories.blogCategoryID = dbo.tblBlogCounter.blogCategoryID
WHERE (dbo.tblBlogCounter.blogCounterDate > GETDATE() - .001) OR
(dbo.tblBlogCounter.blogCounterDate > GETDATE() - .001)
GROUP BY dbo.tblBlogCategories.blogCategoryName,
dbo.tblBlogCategories.blogCategoryID, dbo.tblBlogCategories.blogViewType
HAVING (dbo.tblBlogCategories.blogViewType = 1) OR
(dbo.tblBlogCategories.blogViewType = 4)
ORDER BY dbo.tblBlogCategories.blogViewType DESC,
dbo.tblBlogCategories.blogCategoryName

I would like this query to return all results from the left table and show
resutls from the right table that have dates old than a certain value.

The moment I add the getdate clause it will only return matched results like
an inner join, any ideas how I force it to return all the results from the
left table as well?

Many thanks for any help.

0 new messages