You are going to need some more complex SQL, because you have to check that the last trap received trap for the oidvalue:
INNERJOINtrapsa
ONa.nodeid=nodes.nodeid
ANDa.traptype='HHMSAGENT-MIB:spUnknownStatus.301'
INNERJOINtrapvarbindsb
ONa.trapid=b.trapid
ANDb.oidname='spSensorValue'
WHERE a.acknowledged=0
ANDa.datetime>=Dateadd(hour,-4,Getdate())
ANDa.datetime=(SELECTMax(datetime)
FROM trapst
WHERE t.nodeid=a.nodeid
ANDT.traptype=
'HHMSAGENT-MIB:spUnknownStatus.301')
ANDb.oidvalue='1'