我如何将这个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')

最佳答案

我建议使用此工具进行转换:https://www.linqpad.net/

08-03 20:25