开发者

Equivalent LinQ Query

Can someone help convert this query to SQL. I need this in linQ and I dont have write perms to get alternative for Storedprocedure. So linQ is the on开发者_如何学Pythonly way for me now to get it used with Silverlight

SELECT ISNULL(COUNT(BGID),0)AS BGCOUNT,CASE SOURCE.PRIORITY
WHEN 1 THEN  'P1'
WHEN 2 THEN  'P2'
WHEN 3 THEN  'P3'
END AS PRIORITY FROM
(SELECT DISTINCT PRIORITY  AS PRIORITY FROM BGS WHERE PRIORITY IS NOT NULL)AS SOURCE
 LEFT OUTER JOIN BGS ON BGS.PRIORITY = SOURCE.PRIORITY AND        
       TREEPATH NOT LIKE '%Prod%' AND TREEPATH LIKE '%TMS%' AND
       TREEPATH NOT LIKE 'BG\structure\Aut\TMS%' AND STATUS = 'ACTIVE'  AND
       (ASSIGNEDTO = 'cato14' OR ASSIGNEDTO IN 
       ('useratadi','userajsudh','useramanna','useritnaga'))
GROUP BY SOURCE.PRIORITY
ORDER BY SOURCE.PRIORITY 


If you already have SQL you're happy with, you can skip translating it to linq by calling DataContext.ExecuteQuery<T>.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜