0

i have an interesting question for you guys.

SELECT   S.SCHOOLID AS [SCHOOLID],S.SCHOOLNAME AS [SCHOOLNAME],SP.PHOTO AS [PHOTO]
FROM SCHOOLPHOTO SP
INNER JOIN SCHOOL S
ON SP.SCHOOLID = SP.SCHOOLID
WHERE S.SCHOOLID  IN (SELECT SCHOOLID FROM #SCHOOLS)

the Photo Field is an Image Datatype Field, i now you can use them in a Distinct or group by , How can i go by have that field there without casting it , because if i cast it it will not work together in Silverlight or any other image control.

Thanks

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by vuyiswamb
0
;with cteSchools as (SELECT DISTINCT S.SCHOOLID AS [SCHOOLID],S.SCHOOLNAME AS [SCHOOLNAME]
FROM SCHOOL S

WHERE S.SCHOOLID IN (SELECT SCHOOLID FROM #SCHOOLS))


SELECT S.SCHOOLID AS [SCHOOLID],S.SCHOOLNAME AS [SCHOOLNAME],SP.PHOTO AS [PHOTO]
FROM cteSCHOOLS S
CROSS APPLY (Select TOP (1) PHOTO from SchoolPhoto SP
WHERE SP.SCHOOLID = S.SCHOOLID
ORDER BY SCHOOLID DESC) SP

Solved the Problem

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.