GROUP BY子句在sqlite中获取逗号分隔的值 [英] GROUP BY clause to get comma-separated values in sqlite

查看:114
本文介绍了GROUP BY子句在sqlite中获取逗号分隔的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表结构是这样,使用sqlite3

My table structure is like this, using sqlite3

           CREATE TABLE enghindi (eng TEXT,hindi TEXT)

我有一个名为 enghindi 的表,其中有两个名为 hindi eng 的列,我想合并eng列的记录,并且用逗号分隔印地文单词

i have an table named enghindi in that there is two column named hindi, eng, i want to merge eng column's record and also combine hindi word by comma separated

看看下表是什么样子

我想在下面看起来像这样

i want to do look like this below

我想通过sqlite3查询做到这一点

i want to do this with sqlite3 query

推荐答案

这应该有效:

SELECT GROUP_CONCAT(eng), hindi FROM enghindi GROUP BY hindi;

这篇关于GROUP BY子句在sqlite中获取逗号分隔的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆