これは私が持っているリストの種類です
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