group-concat Questions

2

I am having a trouble with using GROUP_CONCAT in MySQL My tables g0 as follows: ID Age Sex ------------- 1 16 Male 2 18 Female 3 16 Male 4 18 Female 5 16 Male But I need the table to look like ...
Purlieu asked 20/12, 2015 at 7:8

4

Solved

i've used GROUP_CONCAT to get results splitted by comma (,), but when i saw, the GRUP_CONCAT returned only 205 splitted numbers, but in the database there's 2448 results (different aid). Here is my...
Boden asked 28/2, 2017 at 12:4

3

Solved

I have a normalized database and I'm trying to return data from multiple tables using JOINs and GROUP_CONCAT. Problem: Rows are being duplicated with GROUP_CONCAT. I can't use DISTINCT because so...
Pilferage asked 3/5, 2014 at 23:46

3

Solved

I make my join from a farmTOanimal table like this. There is a similar farmTotool table id | FarmID | animal 1 | 1 | cat 2 | 1 | dog When I join my tables in a view, I get a result that looks ...
Unforgettable asked 30/12, 2010 at 9:56

7

I am doing SELECT GROUP_CONCAT(categories SEPARATOR ' ') FROM table. Sample data below: categories ---------- test1 test2 test3 test4 test1 test3 test1 test3 However, I am getting test1 test2 te...
Journalize asked 21/6, 2010 at 9:37

12

Solved

Say I have the following table called fruits: id | type | name ----------------- 0 | apple | fuji 1 | apple | mac 2 | orange | navel My goal is to ultimately come up with a count of the diffe...
Antidromic asked 26/4, 2012 at 20:7

48

Solved

Consider a database table holding names, with three rows: Peter Paul Mary Is there an easy way to turn this into a single string of Peter, Paul, Mary?
Thirlage asked 11/10, 2008 at 23:49

4

Solved

In Sqlite I can use group_concat to do: 1...A 1...B 1...C 2...A 2...B 2...C 1...C,B,A 2...C,B,A but the order of the concatenation is random - according to docs. I need to sort the output of g...
Stander asked 13/12, 2009 at 18:56

2

Solved

I have three tables: table "package" ----------------------------------------------------- package_id int(10) primary key, auto-increment package_name varchar(255) price decimal(10,2) ta...
Tentative asked 14/10, 2010 at 17:12

1

Solved

I am trying to do a str_replace without success.. for some reason the data from MySql isn't working inside the str_replace function... Code to bring all strings which will be used to replace the st...
Buffoon asked 16/1, 2023 at 15:8

9

Solved

I have a table and I'd like to pull one row per id with field values concatenated. In my table, for example, I have this: TM67 | 4 | 32556 TM67 | 9 | 98200 TM67 | 72 | 22300 TM99 | 2 | 23009 TM99...
Waterside asked 1/4, 2010 at 14:9

3

Solved

I have several lines of SQL code for my legacy database with GROUP_CONCAT statements, as in: SELECT SUM(age), GROUP_CONCAT(sal) FROM Users; In PostgreSQL, I can do the same with: SELECT SUM(age...
Popliteal asked 4/12, 2017 at 16:21

2

Solved

I am having data like this 1 A 1 B 1 C 1 D 2 E 2 F 3 G 3 H 3 I 3 J 3 K by using this query select ABSTRACTS_ITEM._id,Name from ABSTRACTS_ITEM , ABSTRACT_AUTHOR , AUTHORS_ABSTRACT where ABSTRAC...
Infective asked 13/9, 2013 at 5:21

2

Solved

I'm using the following query and it's returning the expected results.. except for the fact that the concatenated results appear to be cut off. Example: "1965 Chevrolet Suburban, 1958 Chevrolet ...
Cosmism asked 22/7, 2013 at 15:27

16

Solved

Using MySQL, I can do something like: SELECT hobbies FROM peoples_hobbies WHERE person_id = 5; My Output: shopping fishing coding but instead I just want 1 row, 1 col: Expected Output: shop...
Adiell asked 10/11, 2008 at 2:34

3

Solved

I'm trying to get distinct values when using GROUP_CONCAT in BigQuery. I'll recreate the situation using a simpler, static example: EDIT: I've modified the example to represent better my real sit...
Peti asked 20/2, 2015 at 21:12

6

Solved

Given a table of "events" where each event may be associated with zero or more "speakers" and zero or more "terms", those records associated with the events through join tables, I need to produce a...
Assimilable asked 14/11, 2012 at 16:24

7

Solved

I need something similar to these 2 SO questions, but using Informix SQL syntax. Concatenate several fields into one with SQL SQL Help: Select statement Concatenate a One to Many relationship ...
Conners asked 3/4, 2009 at 19:30

6

Solved

I seem to come against this problem a lot, where I have data that's formatted like this: +----+----------------------+ | id | colors | +----+----------------------+ | 1 | Red,Green,Blue | | 2 | Or...
Heaney asked 25/6, 2013 at 22:30

2

Solved

I have a large table with data that is not unique but needs to be. This table is a result of multiple union selects so is not an actual table. I cannot make it an actual table for other reasons. Al...
Hildy asked 1/4, 2014 at 10:18

2

Solved

I have the following query which I want to use with ActiveRecord so that it can be translated in native ORACLE based query on production server. Right now I am using SQLITe. select c.name,co.code,...
Allele asked 26/1, 2015 at 8:38

5

Solved

I've a table like: +-----------+-------+------------+ | client_id | views | percentage | +-----------+-------+------------+ | 1 | 6 | 20 | | 1 | 4 | 55 | | 1 | 9 | 56 | | 1 | 2 | 67 | | 1 | 7 | 80...
Shown asked 25/12, 2011 at 19:38

4

Solved

This is my table: id | fk_company ------------------- 1 | 2 2 | 2 3 | 2 4 | 4 5 | 4 6 | 11 7 | 11 8 | 11 9 | 12 The result I want should be string "3, 2, 3, 1" (count o...
Marcille asked 4/7, 2013 at 6:21

7

Solved

I'm using GROUP_CONCAT() in a MySQL query to convert multiple rows into a single string. However, the maximum length of the result of this function is 1024 characters. I'm very well aware that I c...
Demosthenes asked 2/4, 2010 at 13:59

8

Solved

How create json format with group-concat mysql? (I use MySQL) Example1: table1: email | name | phone ------------------------------------- [email protected] | Ben | 6555333 [email protect...
Plotinus asked 20/9, 2012 at 11:45

© 2022 - 2024 — McMap. All rights reserved.