Will selecting specific columns affect the number of rows in MySQL?
P粉9646829042024-03-29 22:53:26
0
1
349
I have a simple query with a few joins, but when I add columns to my selection from the same set of joins, just adding or removing columns from the selection without changing any of the joins, the number of rows There will be changes.
Yes, they can. For example, your query, or "simple query" as you call it, can have different keywords, and adding a column to a similar select will change the total number of rows in the results.
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. For example, your query, or "simple query" as you call it, can have different keywords, and adding a column to a similar select will change the total number of rows in the results.
VS
This is a demo