2013-05-03 161 views
0

我有一個SQL查詢,我應該在實體框架中使用它。我是Entity的新成員,我不知道我該怎麼做。我的查詢是:實體框架嵌套選擇查詢

SELECT EKIP, 
     COUNT (SAGLA) AS KPISAYISI 
FROM 
    (SELECT M.APPLICATIONID AS ORTAM, 
      MNAME AS SERVIS, 
      sum(AVAIL*HIT)/SUM(HIT) AS SAGLA, 
      SUM(HIT) AS CAGRI , 

    (SELECT DOMAINNAME 
     FROM SOAGOVERNANCE_SERVICE D 
     WHERE D.NAME=m.MNAME 
     AND D.APPLICATIONID=m.APPLICATIONID) AS EKIP 
    FROM SOAGOVERNANCE_METRICLOG m 
    WHERE MDATE BETWEEN '2013-01-01 01:00:00' AND '2013-02-01 01:00:00' 
    AND MTYPE='SERVICE' 
    GROUP BY APPLICATIONID, 
      MNAME) S 
WHERE S.CAGRI > 3 
    AND S.SAGLA<90 
GROUP BY EKIP 
ORDER BY EKIP 

回答

0

最簡單的方法是創建一個SQL視圖與你查詢。 然後在視圖上創建實體。

或者你想在實體中完整查詢?

+0

你認爲它的答案? – 2015-09-07 19:45:33