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

1228 questions
-1
votes
1 answer

show null records in group_concat

I have two tables like this profile_answers +---------+------------+ | id | class_name | +---------+------------+ | 1 | Class 1 | | 2 | Class 2 | | 3 | Class 1 …
Manjunath Manoharan
  • 4,309
  • 5
  • 24
  • 41
-1
votes
4 answers

MySQL Group Concat Single Column NULL

I have a column that i am looking to retrieve all matches of in one row. I am querying other data as well. Currently i am using group_concat. This has worked great until now. Sometimes there are potential NULL values in this column and this has been…
The Thirsty Ape
  • 604
  • 3
  • 13
  • 29
-2
votes
1 answer

Combine to one group with the same id or attribute SQL Group_concat doesn't help:(

I need to group row's in one row if they have same id or same attribute. So i suppose i need to use INNER JOIN and GROUP_CONCAT, but i don't know how. Problem is that if two users do not have a common attribute, but fall into the same group with the…
-2
votes
1 answer

SQL First row result in reverse

SELECT item_description, item_variant, branch, GROUP_CONCAT(sum ORDER BY 'date') AS chartData FROM ( SELECT item_description, item_variant, branch, SUM(sales) AS sum FROM inventory_branches WHERE (item_description =…
lekendary
  • 3
  • 3
-2
votes
1 answer

How can I use nested cases in mySQL?

I want to work with nested cases: SELECT *, GROUP_CONCAT(DISTINCT CONCAT( CASE WHEN data.name NOT "field" THEN CASE WHEN data.category = "A" THEN "A" WHEN data.category = "B" THEN "B" ELSE "C" …
peace_love
  • 5,582
  • 8
  • 38
  • 100
-2
votes
1 answer

Using limit in group by

This is my table. Financials: Date CountryID ProductID Revenue Cost I need to find the top 5 products by revenue for each country. Some products will be listed more than once, so I need to sum the revenue for each…
EdwardC
  • 103
  • 8
-2
votes
1 answer

GROUP_CONCAT row if values

I need to count records from a table but I must treat values with pId 55 and 61 as one only if the user_id is the same. id pId user_id 6126 55 127742 6128 55 127584 6132 58 128788 6134 55 54445 6136 55 127897 6139 61 …
Ciprian
  • 2,567
  • 5
  • 48
  • 85
-2
votes
1 answer

mysql children in the same row of parents

is there any way to have the schema you see here in the SqlFiddle shown as: SKU | size S | size M | size L | init_qty | qty ? I was trying to use GROUP_CONCAT by it is no what I am looking for. Here it is my query select sku, name,…
Aptivus
  • 423
  • 1
  • 8
  • 21
-2
votes
2 answers

Unexpected result from JOIN and GROUP_CONCAT with three tables

here's an link to the schema and sql: http://sqlfiddle.com/#!9/d99b6/8 Schema: create table movies ( id int, movie_name varchar(20) ); create table genre ( movie_id int, genre varchar(20) ); create table actors ( movie_id int, …
-2
votes
2 answers

How to use MYSQL GROUP BY SUM with multiple columns

Basically the question is how to get the sum from #hours, groupping by #id, #code, #semester, #year columns from this id, hours, code, semester, year 165, 6, 3, 1, 2012 166, 6, 16, 1, 2012 460, 8, 14, …
Marco
  • 147
  • 1
  • 3
  • 14
-3
votes
1 answer

Group_CONCAT search

Possible Duplicate: Combining several database table together? I have following query and want done where with each value that is in $find for name_re_all, how is it in my query? For example: name_re_all is as: ROW 3: 11111 22222 33333 44444 ROW…
Jennifer Anthony
  • 2,067
  • 9
  • 33
  • 55
-3
votes
1 answer

mysql inner join group_concat mysql

TABLE 1 : ID CODE 1,2,3,4,5 abc 2,3,4,5 xyz TABLE 2 : ID NAME 1 NM1 2 NM2 3 NM3 4 NM4 5 NM5 join is on ID . I need to fetch NAME using join where CODE = 'abc' Any help appreciated
minesh..
  • 155
  • 12
-4
votes
1 answer

MySQL - Issue with SELECT & GROUP BY

Hello the wonderful community, I have a basic config MySQL / PHP with this DB : Pages Table Tags Table Pages_Tags Table Query : SELECT *, GROUP_CONCAT('tags_name') FROM pages LEFT JOIN pages_tags ON pages_tags.pages_id = pages.pages_id LEFT…
Coool6
  • 13
  • 4
1 2 3
81
82