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
3
votes
4 answers

SQL Server: How do I return all columns where one is not repeated?

I've got a table with repeating IDs which I will fix later. Basically I want to return all the rows where the ID is distinct, but I want the ENTIRE row. Something like: select * from table group by ID select * from table where (ID is not…
Ehryk
  • 1,930
  • 2
  • 27
  • 47
3
votes
2 answers

Limit results on an GROUP_CONCAT() or INNER JOIN

I've perused extensively the other threads talking about limits on group_concat() and inner joins but haven't found my answer, so I guess I'll go ahead and ask it: I'm developing an existing photo community site. I want to retrieve members who have…
indorock
  • 316
  • 1
  • 4
  • 12
3
votes
3 answers

mysql group_concat issue

I just trying to know is this possible the function of MYSQL GROUP_CONCAT to return this type of data. Here is a scenario SELECT GROUP_CONCAT(marks) AS `i need only 40 int in this column` FROM marks when i execute this Query the result will be…
Query Master
  • 6,989
  • 5
  • 35
  • 58
2
votes
1 answer

How to search a value which can returns true in WHERE condition OR in HAVING condition?

I want to search multi vars that could be true in WHERE condition or in HAVING condition in a group_concat table. Something like this: SELECT article.id, article.name, GROUP_CONCAT(tags.name order by tags.name) AS nameTags, …
Leo
  • 580
  • 7
  • 22
2
votes
1 answer

Codeigniter: Selecting the SUM of rows give the SUM times GROUP_CONCAT results?

I'm querying four tables (which are: resources, tag_list, resource_tags and votes) and trying to retrieve a list of resources with each list item having grouped tags and the sum of votes for that resource. This is my current model:…
David
  • 25
  • 1
  • 5
2
votes
2 answers

MYSQL GROUP_CONCAT and half dosen JOINs

I have been trying to get this query to work but I am stumbed right now. Problem is on the JOIN with GROUP_CONCAT in it. I just can't figure how to get it working. What I want is to get buntch of data from RFQs and joining Customers, etc. to it and…
Santtu
  • 35
  • 7
2
votes
2 answers

MySQL GROUP_CONCAT and ORDER and merging columns help please

I've been pulling my hair out for two days trying to put a MySQL query together to pull some data together. This is beyond my level of experience with SQL, however. The following query pulls the data that I need, but I need to format it…
2
votes
1 answer

Substitute for Group_Concat to customize existing Entity Framework model

I'm using a many-to-many database with join tables connecting main data tables through foreign keys. http://img12.imageshack.us/img12/6500/databasew.png With my data representation, it's required to concatenate several rows of subordinate table…
2
votes
1 answer

filtering results of group_concat, inner join query

Newbie here. The code below is doing a great job returning the results I want. The only problem is that I can't figure out how to return only a certain date range (found in checkdate column). The only way I can get it to filter by date of…
dull_bulb
  • 45
  • 4
2
votes
1 answer

GROUP_CONCAT in SELECT statement

I have a small problem with an SQL statement with a GROUP_CONCAT. I have this statement: SELECT ni.*, GROUP_CONCAT(newsletter_item_receivers.value) AS receivers, nf.*, GROUP_CONCAT(nm.mailgroup_name) AS mailgroups FROM newsletter_items ni INNER JOIN…
Morten Hagh
  • 2,055
  • 8
  • 34
  • 66
2
votes
1 answer

MySQL: Optionally Build Group Concat field

I have a set of articles. Some of these articles have been assigned x number of tags. I want to select all articles in the format specified in the SELECT, and if the article also has any number of tags assigned, put them into a single GROUP_CONCAT…
Ian
  • 11,920
  • 27
  • 61
  • 77
2
votes
1 answer

Sql Query To count "different way of stored data"

Here is my Tables data Tickets +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + id | tic_files | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +…
Mona Abdelmajeed
  • 686
  • 1
  • 9
  • 19
2
votes
1 answer

How to join two or more equal consecutive values of column into one in SQLite?

I have this SQL query: SELECT strftime('%Y-%m-%d', start_time) as day, group_concat(event_id, ' | ') as events FROM events_table WHERE start_time BETWEEN '2022-01-01 00:00:00' and '2022-03-31 23:59:59' and event_id is not…
2
votes
0 answers

Mysql GROUP_CONCAT incomplete, well under group_concat_max_len

Issue is shown query below. The table has a column value_mean which is a float. The issue is the last GROUP_CONCAT, it cut off the last 2 characters. Why? MariaDB [testdb]> SELECT a.value_mean, b.value_mean, HEX(a.value_mean), …
bexamous
  • 21
  • 4
2
votes
2 answers

group_concat many times?

I'm trying to make a MySQL query that uses different group_concat with data from the same LEFT JOIN. An example tables could be: Cars table carid | license_plate Tires table (means used tires) carid | model | width From these tables i want to obtain…
xavi
  • 21
  • 1