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

how to sql distinct value inside a column that have multiple string delimeter by ','

enter image description here hello everyone , i'm trying to generate new table using mysql that have difference value (which means eliminating duplicate) in the same column that have so much of string. I already try group_concat(distinct column_name…
Bathulah Mahir
  • 939
  • 1
  • 10
  • 21
-1
votes
1 answer

create an additional column with select union in Mysql

I have 2 tables: table1 and table2, both tables have structure as ; id - day - uniques - pageviews. I want to create an additional field containing uniques values in format like 2387|1283 while at the same time summing up uniques and pageviews for…
burkul
  • 35
  • 4
-1
votes
3 answers

Mysql Union Left Join Group Concat

I need help with this Mysql query Select id, code, Tbldetail from TblProd The result is: id code detail (i Need ADD Model Column Here) 100 432320-1 Keyboard 101 432325-1 Mouse 102 432329-1 …
Peter013
  • 69
  • 4
-1
votes
1 answer

Compare two strings using MYSQL

I have two strings in comma separated. String1='ABC,DEF,PQR,MNO,XYZ' String2='PQR,FGH' String3='GHI,JKL,TUV' Now I want that, compare string1 and string2, it will return true because String2 has value 'PQR' that matches with String1. But…
Khushal
  • 126
  • 1
  • 16
-1
votes
1 answer

GROUP_CONCAT: search for subset and retrieve all values

I have this two tables: posts +--------------------------------------------------------------------+ |id ¦status¦type ¦url …
fusion3k
  • 11,012
  • 4
  • 21
  • 42
-1
votes
1 answer

Why are HAVING and GROUP_CONCAT not working together in this query?

This query: SELECT name, REPLACE(REPLACE(REPLACE(LOWER(name),' ',''),'-',''),':','') AS formattedName, GROUP_CONCAT(service) FROM movies GROUP BY formattedName HAVING COUNT(CASE WHEN name like "%von brom%" THEN 1 END) > 0; Gives me the…
Istlemin
  • 131
  • 1
  • 11
-1
votes
2 answers

Mysql get comma separated list of columns

I have a column with accessories of products as below example: TABLE1 ProductID accessories 1 2,3 2 1,4,5 3 4 1 5 2 It means that for the PRODUCT 2, it has the accessories product ids 1,4 and 5 and i…
inventor
  • 25
  • 1
  • 2
  • 10
-1
votes
2 answers

SQL Server Group By with Group Concat

I have a table like this Hospital Insurance PatientCount H1 I1 1 H1 I1 2 H2 I1 1 H2 I2 1 Want to group this table by insurance as, Hospital Insurance …
-1
votes
1 answer

Group Concat with Left Join

Using Mysql on Joomla 2.5. Here is my code. Works great except doesn't show results where no users (u) attached to team (t). $query = "SELECT DISTINCT(t.id) as id,t.*, GROUP_CONCAT(DISTINCT ' ',MID(u.first_name,1,1) ,'.',u.last_name) as name …
user1071915
  • 99
  • 2
  • 12
-1
votes
1 answer

MySQL group_concat on groups listings

I have the following table: id | group_id | str | position_number 1 | 1 | first | 1 2 | 1 | string | 2 3 | 2 | And | 1 4 | 2 | another | 2 5 | 2 | string | 3 I'm searching for the SQL query which…
dot
  • 446
  • 1
  • 6
  • 16
-1
votes
1 answer

Group_concat distint on selected columns in mysql

I have a table apartment as below aid | aname 1 | dream home 2 | My hub 3 | Lake view another table apartment_details id | aid | bhk | size | facing 1 | 1 | 2 | 1200 | …
rji rji
  • 627
  • 2
  • 14
  • 34
-1
votes
1 answer

How to use GROUP_CONCAT with MAX(CASE WHEN...)?

I want to take result from this query but i have problem in using group_concat with max case. SELECT t1.id, t1.name, MAX(CASE WHEN t2.code = t1.f_name THEN t2.name END) AS name2, MAX(CASE WHEN t2.code = t1.l_name THEN t2.name END) AS name3, …
jones
  • 1,323
  • 1
  • 24
  • 62
-1
votes
1 answer

Mysql Group concat and subtraction values

I tried to calculate the difference in values ​​obtained from a mysql query where data values ​​are extracted in TIME format time laps of competition . the goal is to get the lap times between arrivals for each lap. This is the table Times. id …
-1
votes
1 answer

Unable to convert string to date time in MySQL query

I am working on a project where I have two tables-one is tbllessontopic which saves unique lesson plans and another table tbllessonperiodallocation which saves dates for which the lesson plan will be taught.Now I have applied the query to get all…
rupinder18
  • 735
  • 1
  • 14
  • 38
-1
votes
2 answers

Concatenate SQL results into a single string with a counter

Say I have a table as shown below Product_Id Description BX01 Desc 1 BxX1 Desc 2 Dss3 Desc 3 HHXY Desc 4 I want the result exactly like: 1 - BX01, 2 - BxX1, 3 - Dss3, 4 - HHXY I have…
1 2 3
81
82