如何将这个sql查询转换为linq表达式,我是linq的新手并对其进行了搜索,但是我不明白如何转换它。
SELECT
a.afiliacaoid,
DATE_FORMAT(a.horario, '%d/%m/%Y') data,
COUNT(a.afiliacaoid) acessos,
IFNULL(p.pedidos,0) pedidos
FROM
acesso a LEFT JOIN
(SELECT p.afiliacaoid,
DATE_FORMAT(p.cadastro , '%d/%m/%Y') data,
COUNT(p.afiliacaoid) pedidos
FROM pedido p) p ON a.afiliacaoid = p.afiliacaoid
AND DATE_FORMAT(a.horario, '%d/%m/%Y') = data
WHERE
a.afiliacaoid=1
GROUP BY DATE_FORMAT(a.horario, '%d/%m/%Y')
答案 0 :(得分:0)
我建议使用此工具进行转换:https://www.linqpad.net/
答案 1 :(得分:0)
这是一个很好的工具,可能对您有帮助-http://www.sqltolinq.com