# bottom

relationalai.semantics.std.aggregates

```python
bottom(limit: int, *args: AggValue) -> Aggregate
```

Get the bottom N results in ascending order.

## Parameters

- `limit` (`int`) - Number of bottom results to return.
- `*args` (`AggValue`, default: `()`) - Values to order by (ascending).

## Returns

- `Aggregate` - An `Aggregate` representing the computation of the bottom N results.

## Examples

Get 10 lowest-priced products:

```python
select(Product).where(aggregates.bottom(10, Product.price))
```

Get 5 least selling products per category:

```python
select(Product).where(
    aggregates.bottom(5, Product.units_sold)
    .per(Category)
    .where(Product.category == Category)
)
```

## Referenced By

1. [RelationalAI Documentation](/index.md)1) [Build With RelationalAI](/build/index.md)1. [Use advanced reasoning](/build/reasoning/index.md) / [Rules-based reasoning](/build/reasoning/rules-based/index.md)1) [Aggregate and group data](/build/reasoning/rules-based/aggregate-and-group-data/index.md)1. [Pick top and bottom results](/build/reasoning/rules-based/aggregate-and-group-data/index.md#pick-top-and-bottom-results)
