select distinct ID,NAME,SEX from STUDENT order by TEACHERID;
执行这条SQL语句的时候提示上面错误,错误原因:
order by后面的TEACHERID字段不在select查询结果的字段当中,主要因为SQL语句中含有distinct关键字。
同时使用distinct、order by 关键字时,orderby的字段必须在distinct的字段之中
select distinct ID,NAME,SEX from STUDENT order by TEACHERID;
执行这条SQL语句的时候提示上面错误,错误原因:
order by后面的TEACHERID字段不在select查询结果的字段当中,主要因为SQL语句中含有distinct关键字。
同时使用distinct、order by 关键字时,orderby的字段必须在distinct的字段之中