try
<pre class="c" name="code">
select [廠商],[品號],[金額]
,(case when [群組排序] <> 1 then '' else Convert(varchar,[總金額]) end) as [總金額]
from (
select Row_Number() Over(partition by [廠商] order by [廠商]) as [群組排序]
,*
from ((
select N'A' as [廠商]
, '123' as [品號]
, 100 as [金額]
, 100 as [總金額]
)union(
select N'A' as [廠商]
, '456' as [品號]
, 200 as [金額]
, 300 as [總金額]
)union(
select N'B' as [廠商]
, '789' as [品號]
, 300 as [金額]
, 300 as [總金額]
)) as k
) as k