0

这是我的清单

Vehicle           ECU       ID           Value
Bumblebee         EBS7      88           12345
Bumblebee         EBS7      89           96325
Bumblebee         EBS7      90           14725
Bumblebee         TMS1      89           12347  
Godzilla          TMS1      88           15963 
Godzilla          TMS1      89           12347
Godzilla          EBS7      88           12345
Godzilla          EBS7      89           96325
Prime             EBS7      88           25899
Prime             EBS7      89           12347

我做了一个存储过程。我的愿望是我想写这样的东西

Exec spVehicles 'EBS7', '88,89', '12345,96325'

我想要的结果应该是这样的

Vehicle
Bublebee 
Godzilla

有小费吗?这是我拥有的当前代码

alter procedure spGetLatest 
@ECU nvarchar(20),
@Identifier nvarchar(20),
@Value nvarchar(20)
as
Begin
Select Name,ECU, Identifier, Value, Max(Filetime) as "latestfile" from dbo.view_1
group by Name, ECU, Identifier, Value
Having ECU IN (Select Item from [dbo].[SplitString](@ECU,',')) and 

Identifier IN (SELECT Item  FROM [dbo].[SplitString]( @Identifier, ',' ) ) and Value IN (Select Item FROM [dbo].[SplitString](@Value,','))  
ORDER BY
    MAX(Name) ASC
End
4

0 回答 0