Will selecting specific columns affect the number of rows in MySQL?
P粉964682904
P粉964682904 2024-03-29 22:53:26
0
1
361

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.

P粉964682904
P粉964682904

reply all(1)
P粉250422045

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

This is a demo

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template