Question: I have a table with following data.

```
id country serial other_column
1  us      123    1
2  us      456    1
3  gb      123    1
4  gb      456    1
5  jp      777    1
6  jp      888    1

7  us      123    2
8  us      456    3
9  gb      456    4
10  us     123    1
11  us     123    1

```

Is there a way to fetch 2 rows per unique country and unique serial?

For example, expecting following results from my query.

us,123,1 comes twice cos there was 3 of the same kind and I want 2 rows per unique country and unique serial.

```
us,123,1
us,123,1 
us,456,1
gb,123,1
gb,456,1
jp,777,1
jp,888,1

```

I can't use:

```
select distinct country, serial from my_table; 

```

Since I want 2 rows per distinct value match for country and serial. Pls advice.

Answer: 
You could try to add a `QueuedReceiverComSpec` on the receiver port and set the `queueLength` to e.g. 2. You should then use `Rte_Receive` instead of `Rte_Read` API and read until it returns `RTE_E_NO_DATA` in order to get all values provided by the other component.
What do you want to achieve?

Shall the receiver only get the **latest** value written by the sender? Then your solution is already sufficient.

Shall the receiver get **all** values that the sender wrote to the interface? Then you need to introduce a queue on the receiver port. In the receiver runnable, you can then read all elements in the queue until it is empty.

For more details, check the [AUTOSAR RTE specification](https://www.autosar.org/fileadmin/user_upload/standards/classic/4-2/AUTOSAR_SWS_RTE.pdf) (chapter 4.3.1).