我觉得贴主的意思是按year来分组统计。 select year from tbname group by year
what's the difference between 1. select year from tbname group by year 2. select distinct year from table Output Exact same , But 1 will be slow
select distinct year from table
distinct就是排除结果集中相同的条目
select distinct year from table order by year
select distinct year from table order by year = select distinct year from table
Select Year from table group by year
select distinct year from table order by year asc
select distinct year from table order by year asc; Select Year from table group by year;都可以前者速度要快,后者可以做统计:加上sum函数 ================================================================ ★★ chen_cyh(逐波流) ●
select year from tbname group by year
1. select year from tbname group by year
2. select distinct year from table Output Exact same , But 1 will be slow
=
select distinct year from table
order by year asc
order by year asc;
Select Year from table group by year;都可以前者速度要快,后者可以做统计:加上sum函数
================================================================
★★ chen_cyh(逐波流) ●