?????????μ?????μ???????????÷???
???????????? ???????[ 2012/9/7 11:47:08 ] ????????
???????????????????????????????????????????????£?
CREATE TABLE [dbo].[WUSU_SUOLITest_Table](
[ID] [bigint] IDENTITY(1??1) NOT NULL??
[ReceiveTime] [datetime] NULL??
[GroupID] [bigint] NOT NULL??
[DataValue] [float] NULL??
[SensorCode] [char](10) NOT NULL??
)
???????????????????????????????????????????????????????豸??????id?е???ReceiveTime???????
?????????????SensorCode??????????豸??????50???豸???30?????????????ReceiveTime??????????????????????????????豸????ε??????
???????????????μ??????
select * from WUSU_SUOLITest_Table where id in (select max(id) from WUSU_SUOLITest_Table group by SensorCode )
???????????????С??????????????????????????????????????????????????14???к?????????????id???о????????SensorCode?????????????????ж?????á??????????????group by???
???????????????????????????????????????????????????β???????????μ??????????????????????????????????50??????????????????
create TRIGGER [dbo].[UpdateWUSU_LastOriginalDataSUOLI]
ON [dbo].[WUSU_SUOLITest_Table]
AFTER INSERT
AS
BEGIN
declare @SensorCode char(10)?? @DataValue float ??@ReceiveTime datetime ??@GroupID bigint
select @SensorCode=SensorCode??@DataValue=DataValue??@ReceiveTime=ReceiveTime??@GroupID=GroupID from inserted
update WUSU_LastOriginalData set DataValue=@DataValue??ReceiveTime=@ReceiveTime??GroupID=@GroupID
where SensorCode=@SensorCode
END
?????????????????????豸?μ?????????????????μ???????????????100????????????????????????????????????????
????????????и??????????????????????£????????????
??????????????ù?????????????????group by???????????????????????????????????????????20????
select * from WUSU_SUOLITest_Table as t
where id = (select max(id) from WUSU_SUOLITest_Table where SensorCode=t.SensorCode )
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11