I needs to `SELECT` a column based on `ORDER BY` and using also `GROUP BY`.

For instance, I have the following data:

```
id | type | value | priority
-    A      1       100
-    A      2       0
-    B      3       0
-    B      4       100

```

I need `GROUP BY type`, `SELECT value` considering `ORDER BY priority DESC`. In this case, the output will be:

```
type | value
A    | 1
B    | 4

```

Currently I can select the `MIN()` or `MAX()` values reported by `value`, for instance:

```
SELECT MAX(value) ... GROUP BY type

```

But it will returns wrong:

```
type | value
A    | 2
B    | 4

```

What I need is something like:

```
SELECT (value ORDER BY priority DESC) ... GROUP BY type

```