选定的列可以更改MySQL中的行数吗?

发布于 2025-02-01 00:44:50 字数 75 浏览 6 评论 0原文

我有一个简单的查询,上面有几个连接,但是当我从相同的连接组中将列添加到选择中时,只需在选择中添加或删除选择列而不更改任何连接来更改行数。

I have a simple query with a couple of joins but when I add columns in to my selection from the same set of joins, number of rows change by just adding or removing columns in selection without changing any joins.

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

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

发布评论

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

评论(1

蹲在坟头点根烟 2025-02-08 00:44:50

是的,他们可以。您的查询或称其为“简单查询”可以使关键字不同,并将列添加到类似的选择中会更改结果中的总行数。

select distinct t1.id, t2.id
from t1
left join t2 on t1.id = t2.id

vs

select distinct t1.id, t2.id, t2.job
from t1
left join t2 on t1.id = t2.id

Yes they can. Your query or as you call it "simple query" can have, for example, keyword distinct and adding a column to a select like that will change the number of total rows in your result.

select distinct t1.id, t2.id
from t1
left join t2 on t1.id = t2.id

VS

select distinct t1.id, t2.id, t2.job
from t1
left join t2 on t1.id = t2.id

Here is a demo

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