select c.name, trunc((c.num / b.total) * 100, 2) amount
from (select b.name, a.jfdd, count(1) num
from yy a
left join xx b on b.id = a.jfdd
where a.jflx = '1'
group by b.name, a.jfdd) c,
(select count(1) total from nn) b
order by amount desc
count(1)統計表中的總記錄數,
trunc(小數,需要保留幾位) 對小數進行處理,根據第二位參數的值确定保留幾位小數
order by 字段名 desc 從大到小排序,
order by 字段名 asc 從小到大排序
group by 字段名,根據字段進行分組,字段名一緻的為一組