select P.PNAME
from R T
join P on P.PNO=T.PNO
where not exists(select 1
from S
left join R on S.SNO=R.SNO
and R.PNO=T.PNO
where R.SNO is null)
select S.SNO
,sum(case when P.单价 is not null
then P.单价*R.销售数量
else 0
end
) as '销售金额'
from S
left join R on S.SNO=R.SNO
left join P on P.PNO=T.PNO
group by S.SNO