I need to get from a query the rows with the value equal to a parameter or the one that are the closed based on ID.

```
ID          Value
----------- -----------
1           1
1           2
1           3
2           1
2           2
3           1

CREATE TABLE #Test (ID int, Value int)

INSERT INTO #Test VALUES (1,1)
INSERT INTO #Test VALUES (1,2)
INSERT INTO #Test VALUES (1,3)
INSERT INTO #Test VALUES (2,1)
INSERT INTO #Test VALUES (2,2)
INSERT INTO #Test VALUES (3,1) 

```

So for a value = 3 it should return 

```
ID          Value
----------- -----------
1           3
2           2
3           1

```

Becouse for ID = 1 we have Value 3, and for the other I want the value that is the closest to my given input 3. 

Edit: 

So for value = 2 it should return 

```
ID          Value
----------- -----------
1           2
2           2
3           1

```