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
-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
  • 55
  • 2
  • 3
  • 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
  • 3
  • 12
-1
votes
1 answer

how to combine two columns and group_concat in Mysql

I will better explain with tables: table size ----------------------------- id | type | size | cont_id | ----------------------------- 1 | GP | 30 | 21 | 2 | FR | 30 | 21 | 3 | UP | 40 | 21 | 4 | GT | 50 | …
Munna Babu
  • 5,496
  • 6
  • 29
  • 44
-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
  • 486
  • 1
  • 8
  • 17
-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
  • 697
  • 3
  • 17
  • 37
-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,423
  • 3
  • 35
  • 76
-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
  • 795
  • 1
  • 18
  • 43
-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
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,567
  • 6
  • 28
  • 43
-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
  • 983
  • 3
  • 16
  • 31
-2
votes
1 answer

my query won't run, and I think the query is correct, anyone knows what I did wrong?

SELECT usertype CONCAT(start_station_name ,"to", end_station_name) AS route, COUNT (*) AS num_trips, ROUND(AVG(cast(tripduration as int64/60),2) AS duration FROM bigquery-public-data.new_york_citibike.citibike_trips GROUP BY start_station,…
dejite
  • 1
-2
votes
2 answers

UPDATE statement using GROUP_CONCAT()

I'm attempting to create a single query that UPDDATES another table where the SUBQUERY/ DERIVED-QUERY uses two functions, GROUP BY and GROUP_CONCAT(). I'm able to get my desired output if I utilize a intermediate temporary table to store the…
-2
votes
1 answer

GROUP_CONCAT with null values Mysql

I am trying to make a query that groups all the terms associated with an ID, but it only shows me the ones that are related, how can I display the other ID's even though it is not related to any term in another table and concatenate null?. My Mysql…
1 2 3
88
89