你能帮我一个LINQ查询吗?

时间:2017-01-24 12:49:23

标签: mysql asp.net asp.net-mvc linq

我得到了这个MySQL查询,我想将其更改为LINQ查询。

MySQL:

SELECT
    id,
    cas_poziadavky,
    nazov_linky,
    stanica,
    cas_prichodu,
    meno_udrzbara,
    pricina_problemu,
    riesenie_problemu,
    cas_odchodu,
    bol_prestoj,
    poznamka,
    TIMESTAMPDIFF(MINUTE, cas_poziadavky, cas_odchodu) AS rozdiel',
    TIMESTAMPDIFF(MINUTE, cas_poziadavky, cas_prichodu) AS 'reakcia',
    TIMESTAMPDIFF(MINUTE, cas_prichodu, cas_odchodu) AS 'vyriesenie'
FROM 
    monitor_linky

你能帮我吗?

1 个答案:

答案 0 :(得分:1)

只需翻译您的查询,例如:

IQueryable<Customer> custQuery =  
from cust in db.Customers  
where cust.City == "London"  
select cust;  

此链接可能会为您提供更多信息:https://msdn.microsoft.com/en-us/library/bb397906.aspx

希望这可以帮助你:)