Group by first letter, alphabetically, best way?

前端 未结 2 944
悲&欢浪女
悲&欢浪女 2021-01-21 12:41

Here is my code:

2条回答
  •  心在旅途
    2021-01-21 12:55

    What would be the best way to do this?

    If you are fetching row from the database why can not rather GROUP BY there and get the records. That's the preferred way of doing it.

    Assuming that the column name is first_name

    group by substr(first_name,1,1)
    

提交回复
热议问题