Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 error using text data type

Author  Topic 

-Dman100-
Posting Yak Master

210 Posts

Posted - 2004-09-17 : 13:03:44
I receive an error when including the field "blogComment" in the query listed below. The data type for the field "blogComment" is set to text in the database.

If I strip out the field "blogComment" the query works fine. Is there a way around this, so I can still include the field "blogComment" with the text data type?

This is the query I'm using:

SELECT TOP 5
W.blogDate,
W.blogHeader,
W.blogComment,
W.blogPostTime,
COUNT(C.blogID) AS Comments
FROM dbo.Weblog AS W
LEFT OUTER
JOIN dbo.UserComments AS C
ON W.blogID = C.blogID
GROUP BY
W.blogDate,
W.blogHeader,
W.blogComment,
W.blogPostTime
ORDER BY
W.blogDate DESC

Thanks for any help.
-D-

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-17 : 15:15:38
i haven't tested this but it should give u some ideas:


select t2.blogDate,
t2.blogHeader,
t2.blogComment,
t2.blogPostTime
t2.Comments
from (
SELECT TOP 5
W.blogDate,
W.blogHeader,
W.blogPostTime,
COUNT(C.blogID) AS Comments
FROM dbo.Weblog AS W
LEFT JOIN dbo.UserComments AS C ON W.blogID = C.blogID
GROUP BY W.blogDate, W.blogHeader, W.blogPostTime
ORDER BY W.blogDate DESC
) t1
inner join dbo.Weblog t2 on
t1.blogDate = t2.blogDate and
t1.blogHeader = t2.blogHeader and
t1.blogPostTime = t2.blogPostTime


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -