Firebrand
Starting Member
24 Posts |
Posted - 2010-07-05 : 11:00:03
|
Hello everyone,the query below works fine until I introduce co.content, which is a column of the text data type. Then I get the error below which tells me that the data type cannot be sorted, which probably means GROUP. Do I need to change my data type or is there a way round this by changing the query?Many thanks----------SELECT *FROM (SELECT lo.LanguageOrderID AS OrderID, lo.CountryID AS OrderCountryID, lo.CountryLanguageID, lo.LanguageID AS OrderLangID, co.ContentID, co.languageID, co.CountryID, co.CourseID, co.content, c.DomainURL, lg.LanguageCode FROM ( SELECT LanguageOrderID, CountryLanguageID, LanguageID FROM tblLanguageOrder GROUP BY LanguageOrderID, CountryLanguageID, LanguageID) AS l CROSS JOIN ( SELECT LanguageID, CountryID, ContentID FROM tblContent GROUP BY LanguageID, CountryID, ContentID) AS t LEFT JOIN tblLanguageOrder AS lo ON lo.LanguageID = l.LanguageID LEFT JOIN tblContent AS co ON co.CountryID = t.CountryID LEFT JOIN tblLanguages AS lg on lg.LanguageID = co.LanguageID LEFT JOIN tblCountries AS c on c.CountryID = co.CountryID WHERE lo.CountryLanguageID = co.CountryID AND lo.LanguageID = co.LanguageID AND co.CourseId = 179 AND co.ContentTypeID = 11 AND lo.CountryID = 5 AND (co.ContentStatus = 1 OR co.ContentStatus = 2) GROUP BY co.ContentID, co.languageID, co.CountryID, co.content, co.languageID, co.CourseID, lo.LanguageOrderID, lo.CountryID, lo.CountryLanguageID, lo.LanguageID, lg.LanguageCode, c.DomainURL)AS dtWHERE LanguageID = 5ORDER BY OrderID---------Server: Msg 306, Level 16, State 2, Line 1The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. |
|