What is the best way to perform an aggregate function on an
For example, where binImage is
max( case when somechar = 'A' and anotherchar = 'B' then binImage else null end ) as result
Image is really just a varbinary anyway so just cast it as such and then cast it back if you need to. here is an example to show you that it works.
DECLARE @Table AS TABLE (I IMAGE) INSERT INTO @Table (I) VALUES (CAST('abcdefghi' AS IMAGE)),(CAST('abcdefghi' AS IMAGE)),(CAST('abcdefghi' AS IMAGE)) SELECT CAST(MAX(CAST(I AS VARBINARY(MAX))) AS IMAGE) as Img FROM @Table