Questions tagged [group-concat]

a function which returns a string representation of the concatenated, non-NULL values of a group

GROUP_CONCAT() or group_concat() is a function which returns a string representation of the concatenated, non-NULL values of a group.

This function is available in a variety of relational databases, including MySQL, SQLite, and MariaDB.

Resources

Related Tags

1334 questions
2
votes
1 answer

SPARQL: UNION drops values, OPTIONAL needs separate variables

How can I get all the labels and aliases for a given country, in both English and the official language(s) of this country, as a single column, from wikidata? I initially tried the following but UNION seems to drop the labels in the official…
Marc Carré
  • 1,446
  • 13
  • 19
2
votes
1 answer

Problems with view containing group_contact

I have a view, but when I use it in select the results differs depending on the where clause: select * from cases_keywords2 ck where case_id = 10732 or case_id = 10733 or case_id =…
Jiri Prox
  • 31
  • 4
2
votes
1 answer

group_concat by combining column values of two table

I am trying to combine columns between two tables and concat them. While I am able to use group_concat on the columns which are specific to just one table but there is also a column for which I need to combine from table1.role_id and table2.role_id…
chidori
  • 1,052
  • 3
  • 12
  • 25
2
votes
2 answers

SQL query in pandas: Concat multiple rows in column based on a combination of other columns

This is response from one sql query in pandas. I want to concatenate, "Label column", together based on Issue and client. I tried Group By, but is only works with integer values. Any idea, how I can do this? Pandas based solution should also be…
akshat
  • 1,219
  • 1
  • 8
  • 24
2
votes
2 answers

MySQL joining with grouping did not join perfectly

I have three table and want to join them but the join returns a single row multiple time when using group by parent id from contact table. contact table- id Name 1 Murad 2 Tajharul phone…
Murad Hasan
  • 9,565
  • 2
  • 21
  • 42
2
votes
1 answer

How to union all common columns from every table in SQLite

For tables t1: C1 C2 C3 1 2 3 4 5 6 table t2: C1 C2 C4 33 44 55 What query should be written to do a union of all common columns so that the result will be this: C1 C2 1 2 4 5 33 44 Important to note that I'm not looking for a solution…
Mario
  • 561
  • 3
  • 18
2
votes
2 answers

Coalessing with condition in related table

I am working in MySQL 5.7.35 and I have the following tables: create table Table1 ( Id int not null auto_increment, Name varchar(255) not null, primary key(Id) ); create table Table2 ( Id int not null auto_increment, Name…
J86
  • 14,345
  • 47
  • 130
  • 228
2
votes
1 answer

Ordering a GROUP_CONCAT Column (MySQL)

I was wondering if there was a way to order a GROUP_CONCAT-ed column by another column. Here's my example: Tables users id | name ----+------------ 0 | John Smith users_majors user_id | major_id | order --------+----------+------- 0 | 2…
Steve
  • 2,023
  • 3
  • 17
  • 25
2
votes
1 answer

Show the first X results in Group Concat

I have a query that returns a list of items that an owner has: WITH all_items AS ( SELECT owner.id AS owner, item.title, item.importance FROM owner JOIN item ON …
2
votes
2 answers

Is it possible to group by multiple columns (OR statement) in MySQL?

I'd like to group by 2 columns but in "or mode"... I think I'll explain myself better with an example: ID | Col 1 | Col 2 | Col 3 | Rest of columns ... ------------------------------------------------------- 1 A Q …
FlamingMoe
  • 2,709
  • 5
  • 39
  • 64
2
votes
1 answer

Using GROUP_CONCAT (MySQl) and WM_CONCAT (Oracle) in Propel

Is there a function in Propel ORM which allows me to use something like a GROUP_CONCAT (or WM_CONCAT) aggregation on both Oracle10g and MySQL databases? Well, I know that I can write my own switch, but that's not desirable for me. Any suggestions?
derphil
  • 385
  • 6
  • 25
2
votes
1 answer

How to do group_concat on two fields in sqlite?

My cities table: year | id | city 2005 10 LA 2005 11 SF 2007 12 NY 2008 13 NO with the query: SELECT year, GROUP_CONCAT(id) FROM cities GROUP BY year I get the output: 2005|10,11 2007|12 2008|13 But what I would like to get is…
Ken
  • 94
  • 6
2
votes
1 answer

Elasticsearch aggregation similar to group_concat

I am new to elasticsearch and I would like to create a group_concat aggregation. But I don't know how. Can someone help me please. The example data: POST…
chupacabra
  • 38
  • 5
2
votes
4 answers

GROUP_CONCAT numbering with multiple columns group by

I have a problem with a GROUP_CONCAT select which should also have the row numbering included similar to this question GROUP_CONCAT numbering the difference is that i have to group by multiple columns. As an example I have 2 tables review and…
BHoft
  • 1,663
  • 11
  • 18
2
votes
1 answer

How to change group_concat_max_len on AWS RDS

I have a DB cluster with AWS RDS MySQL serverless. I changed the parameter group group_concat_max_len to 4096, but when run this query: SHOW VARIABLES LIKE '%group_concat%' it gives me 1024 (which is the default value). How can i change it?
Fernando Santiago
  • 2,128
  • 10
  • 44
  • 75