June 17, 2004 at 9:04 am
This SQL statement
SELECT MAX(DISTINCT ProductVersion) AS New, ProductType, ProductDesc, CAST(ProductLogo AS varbinary)
FROM eProducts
GROUP BY ProductType, ProductDesc, ProductLogo
gives me this error
Server: Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
How can I retrieve the above record? ProductLogo is an image column.
June 17, 2004 at 9:51 am
I am making the assumption that each row that has the Version, Type, and an image. Hence you are trying to get the latest version and then return the image for it. This code should do the trick.
-----------------------------------------------
SELECT MAX(DISTINCT ProductVersion) AS New, ProductType, ProductDesc
FROM eProducts
GROUP BY ProductType, ProductDesc, ProductLogo
-----------------------------------------------
Does that do the trick?
June 17, 2004 at 11:33 pm
Nope! am afraid not, I still got the same error... however I have not yet populated the table with the data in question... could that be the problem? If so, then what SQL can insert this data? I presume it will include the file location for the image file
Thx
June 18, 2004 at 1:00 am
Looks like the problem is in the "Group By" clause of then "inner join". It includes the ProductLogo, which is not in the select statment nor can it be used since it's an Image data type. So try:
SELECT MAX(DISTINCT ProductVersion) AS New, ProductType, ProductDesc
FROM eProducts
GROUP BY ProductType, ProductDesc
June 18, 2004 at 1:52 am
Oops . Cheers Pascal, I copied and pasted in a rush, doh!
June 18, 2004 at 8:59 am
Thx let me try that...
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply