Hi,
I'm new to this forum, so I hope I have the correct place to post this...
I have a query below that is not returning the results I need:
SELECT TOP (100) PERCENT dbo.tblBlogCate gories.blogCate goryName,
COUNT(dbo.tblBl ogCounter.blogC ounterID) AS Count,
dbo.tblBlogCate gories.blogCate goryID,
dbo.tblBlogCate gories.blogView Type
FROM dbo.tblBlogCate gories LEFT OUTER JOIN
dbo.tblBlogCoun ter ON
dbo.tblBlogCate gories.blogCate goryID = dbo.tblBlogCoun ter.blogCategor yID
WHERE (dbo.tblBlogCou nter.blogCounte rDate > GETDATE() - .001) OR
(dbo.tblBlogCou nter.blogCounte rDate > GETDATE() - .001)
GROUP BY dbo.tblBlogCate gories.blogCate goryName,
dbo.tblBlogCate gories.blogCate goryID, dbo.tblBlogCate gories.blogView Type
HAVING (dbo.tblBlogCat egories.blogVie wType = 1) OR
(dbo.tblBlogCat egories.blogVie wType = 4)
ORDER BY dbo.tblBlogCate gories.blogView Type DESC,
dbo.tblBlogCate gories.blogCate goryName
I would like this query to return all results from the left table and show results from the right table that have dates newer 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?
Even though I have used the Outer Left Join criteria it still only shows results that have a join with the right table.
Many thanks for any help.
I'm new to this forum, so I hope I have the correct place to post this...
I have a query below that is not returning the results I need:
SELECT TOP (100) PERCENT dbo.tblBlogCate gories.blogCate goryName,
COUNT(dbo.tblBl ogCounter.blogC ounterID) AS Count,
dbo.tblBlogCate gories.blogCate goryID,
dbo.tblBlogCate gories.blogView Type
FROM dbo.tblBlogCate gories LEFT OUTER JOIN
dbo.tblBlogCoun ter ON
dbo.tblBlogCate gories.blogCate goryID = dbo.tblBlogCoun ter.blogCategor yID
WHERE (dbo.tblBlogCou nter.blogCounte rDate > GETDATE() - .001) OR
(dbo.tblBlogCou nter.blogCounte rDate > GETDATE() - .001)
GROUP BY dbo.tblBlogCate gories.blogCate goryName,
dbo.tblBlogCate gories.blogCate goryID, dbo.tblBlogCate gories.blogView Type
HAVING (dbo.tblBlogCat egories.blogVie wType = 1) OR
(dbo.tblBlogCat egories.blogVie wType = 4)
ORDER BY dbo.tblBlogCate gories.blogView Type DESC,
dbo.tblBlogCate gories.blogCate goryName
I would like this query to return all results from the left table and show results from the right table that have dates newer 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?
Even though I have used the Outer Left Join criteria it still only shows results that have a join with the right table.
Many thanks for any help.
Comment