2010-05-31 3 views
0

NHibernate에서 커스텀 SQL을 사용할 방법이 있습니까? 특정 열에 대해 복잡한 SQL을 사용하고 싶습니다.NHibernate - 컬럼에 대해 커스텀 SQL 쿼리 사용하기

예 :

select id, viewsCount, commentsCount, 
    0.2 * viewsCount/(select top 1 viewsCount from articles where isActive = 1 order by viewsCount DESC) as priorityViews, 
    0.8 * commentsCount/(select top 1 commentsCount from articles where isActive = 1 order by commentsCount DESC) as priorityComments, 
    round(0.2 * viewsCount/(select top 1 viewsCount from articles where isActive = 1 order by viewsCount DESC) + 
    0.8 * commentsCount/(select top 1 commentsCount from articles where isActive = 1 order by commentsCount DESC), 1) as priority 
from articles 

답변

관련 문제