SQL多重查询 怎么按照子查询排序

"select ,(select count() from dan as b where b.diquGUIDS=a.GUIDS) as d from diqu as a order by d"

这个SQL语句去掉后面的排序 就对 有排序就出现至少一个值未被指定 求高手赐教 怎么按照子查询排序

as order by
这里as后面缺少东西。

select * ,(select count(*) from dan as b where b.diquGUIDS=a.GUIDS) as d from diqu as a order by d

select ,(select count() from dan as b where b.diquGUIDS=a.GUIDS) as d from diqu as a order by d

子查询的结果是数量 能按数量排序吗

看写法应该不是oracle的,oracle表名别名不能用as
mysql,sqlserver应该都没问题,不知道你是什么数据库