那么当在group by上使用多个列时,mysql如何工作:
select
a.nome,
b.tb2_id,
count(c.tb2_id) as saida
from tb1 a
left join tb2 b on a.tb1_id = b.tb1_id
left join tb3 c on b.tb2_id = c.tb2_id
group by a.tb1_id, b.tb2_id
order by a.tb1_id desc
Run Code Online (Sandbox Code Playgroud)
mysql如何知道它将用于对结果集进行分组的列?
我认为它会按顺序执行,但我将组更改为'b.tb2_id,a.tb1_id',但它没有做任何更改,同样的结果.
| 归档时间: |
|
| 查看次数: |
638 次 |
| 最近记录: |