This is the kind of list i have
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
I have made a stored procedure. The desire is that i want to write something like this
Exec spVehicles 'EBS7', '88,89', '12345,96325'
The result i desire should then be something like this
Vehicle
Bublebee
Godzilla
Any tips? This is the current code i have
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