加入实体并计数不起作用

发布于 2024-12-11 23:19:40 字数 199 浏览 1 评论 0原文

我正在尝试执行此查询,但出现错误:

select c, count(i) as total 
from \Invoice i 
join i.client c 
GROUP BY i.client 

错误:如果不选择至少一个根实体别名,则无法通过标识变量选择实体。

怎么了?我想获取所有客户端实体字段

I 'm trying to execute this query but I get an error:

select c, count(i) as total 
from \Invoice i 
join i.client c 
GROUP BY i.client 

Error: Cannot select entity through identification variables without choosing at least one root entity alias.

What is wrong? I want to get all the client entity fields

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏末染殇 2024-12-18 23:19:40

你可以尝试这个:

select c.*, count(c.id) as total 
from \Invoice i 
join i.client c 
GROUP BY c.id

我真的不知道这是否有效,但在 Doctrine1 的 DQL 实现中,这将是正确的方法。

You may try this:

select c.*, count(c.id) as total 
from \Invoice i 
join i.client c 
GROUP BY c.id

I do not really know if this works but in Doctrine1's DQL implementation this would be the right way to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文