MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / group_by

Method group_by

src/query/helper.rs:277–283  ·  view source on GitHub ↗

Add a group by column ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( cake::Entity::find() .select_only() .column(cake::Column::Name) .group_by(cake::Column::Name) .build(DbBackend::Postgres) .to_string(), r#"SELECT "cake"."name" FROM "cake" GROUP BY "cake"."name""# ); assert_eq!( cake::Entity::find() .select_only() .column_as(cake::Column::Id.count(), "count") .c

(mut self, col: C)

Source from the content-addressed store, hash-verified

275 /// );
276 /// ```
277 fn group_by<C>(mut self, col: C) -> Self
278 where
279 C: IntoSimpleExpr,
280 {
281 self.query().add_group_by([col.into_simple_expr()]);
282 self
283 }
284
285 /// Add an AND HAVING expression
286 /// ```

Callers 6

group_byFunction · 0.80
havingFunction · 0.80
linkedFunction · 0.80
find_baker_least_salesFunction · 0.80
count_fruits_by_cakeFunction · 0.80

Implementers 1

cursor.rssrc/executor/cursor.rs

Calls 2

into_simple_exprMethod · 0.80
queryMethod · 0.45

Tested by 4

group_byFunction · 0.64
havingFunction · 0.64
linkedFunction · 0.64
find_baker_least_salesFunction · 0.64