group by first character

前端 未结 7 1678
天涯浪人
天涯浪人 2020-12-03 04:16

I have a problem with a query in Oracle SQL.

I have a first_name column in an employees table. I want to group my records according to the

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 05:10

    In Rails/postgres that might look something like this

    group_clause = 'UPPER(LEFT(name, 1))'
    Division.group(group_clause).order(group_clause).pluck(group_clause, 'COUNT(id)')
    

提交回复
热议问题