我有一个 sql 查询
select b.logtime,
b.beam_current,
b.beam_energy,
case when a.st2_vs2_bag1_onoff=0 then c.st2_vs2_bag1_rb ELSE 0 END
as st2_vs2_bag1_rb,
CASE when a.st2_vs2_bag8_onoff=0 then c.st2_vs2_bag8_rb else '0' END
as st2_vs2_bag8_rb,
CASE when a.st2_vs2_bag9_onoff=0 then c.st2_vs2_bag9_rb else '0' END
as st2_vs2_bag9_rb
from INDUS2_BDS.dbo.DCCT b
INNER JOIN (
INDUS2_VACUUM.dbo.main_vacuum_analog c
inner join INDUS2_VACUUM.dbo.main_vacuum_status a
on c.logtime=a.logtime
)
ON a.LOGTIME = b.LOGTIME
and (b.beam_current like '%9.96' etc)
and b.logtime between '2014-08-09 00:00:00' and '2014-08-09 23:59:59'
and b.beam_current in('10.01', '20.02', etc)
and ( b.beam_energy between '550' and '551' )
order by b.logtime
现在在给定的日志时间中,单个 beam_current 值在不同的日志时间多次出现。我只想要一个不重复的 beam_current 值。为此,我想在上面的 Sql Query 中应用 row_number 并按 beam_current 分区。但我没有得到如何应用它。