Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withCount 表别名问题 #652

Open
FlameMida opened this issue Nov 23, 2024 · 3 comments
Open

withCount 表别名问题 #652

FlameMida opened this issue Nov 23, 2024 · 3 comments

Comments

@FlameMida
Copy link

Table::alias('t')->leftJoin('tableb tb','t.id=tb.id')->withCount('file')->select();

这种联表查询有别名就会出错。withCount生成的表名还是原表名。

@liu21st
Copy link
Member

liu21st commented Nov 23, 2024

withCount是用于关联查询的 不是原生查询

@FlameMida
Copy link
Author

我Table::alias('t')->hasWhere() 这样用也会不识别别名啊

@liu21st
Copy link
Member

liu21st commented Nov 23, 2024

关联查询方法通常都是配合关联使用的 有内置的机制 不需要使用alias hasWhere也是关联查询的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants