Questions tagged [sql-server-group-concat]

In MySQL GROUP_CONCAT functionality is comma separated values grouped by a defined key.

In MySQL GROUP_CONCAT functionality is comma separated values grouped by a defined key.

62 questions
0
votes
1 answer

Group_concat is not a built in function - HeidiSQL

I have a query with a group_concat in it but it returns an error that the group_concat is not a built in function. Please help me to resolve this. My query is like this: SELECT cast(user_id as varchar(255)) AS…
bleyk
  • 799
  • 3
  • 14
  • 41
0
votes
1 answer

Group By Identical string without converting to concatenated string

Suppose i have 3 tables (like shown below). series_no table: | id | desc_seriesno | |:------|----------------:| | 7040 | AU1011 | | 7041 | AU1022 | | 7042 | AU1033 | | 7043 | AU1044 | | 7044 | AU1055…
0
votes
2 answers

How to correctly translate MySQL query to MSSQL query using GROUP_CONCAT

I'm trying to convert a MySQL DB to MSSQL DB but I'm experimenting some issues when translating the queries, in particular with the following: MySQL SELECT GROUP_CONCAT( parent.Name ORDER BY parent.Lft SEPARATOR "«" ) AS Path, node.Description FROM…
0
votes
1 answer

sql server 2008 group_Concat() version BUT in different columns (NOT comma separated)

I am working on SQL Server 2008 R2. I have below 2 tables: CREATE TABLE TRK_REQUEST( REQUEST_ID int, APPROVER_ID int CONSTRAINT app_ID_fk FOREIGN KEY REFERENCES TRK_APPROVER(APPROVER_ID), APPROVER_LEVEL int) CREATE TABLE TRK_APPROVER(APPROVER_ID…
0
votes
1 answer

SQL Aggregate while joining tables

I have a (temp) table which contains student records. There is another table which contains which students enrolled for which subjects. I would like to update the student table with subjects aggregated into it as shown below. StudentID Name …
0
votes
2 answers

T-SQL - Concatenation of names on TWO tables/orphans

I'm prepared to be crucified for asking my first question on SO and what is a potentially duplicate question, but I cannot find it for the life of me. I have three tables, a product table, a linking table, and a child table with names. Preloaded on…
0
votes
0 answers

Simulate MySql group_concat in MSSQL

I want to run this MySql query in MSSQL. Is there any possibility to achieve that, by modifying this query? Select sku, (select group_concat(sku separator ",") from catalog_product_entity as _e where _e.entity_id in (select product_id from…
Xhevat Ziberi
  • 19
  • 1
  • 10
0
votes
2 answers

sql table from set of rows to one row

My problem is straight forward: i keep trying to transform the output of a table from 1 a 1 b into 1 a b c 1 c 2 d 2 e into 2 d e f 2 f The table will have always sets of 3 rows that will become a table with 4 columns like above. I…
Nathan
  • 24,586
  • 4
  • 27
  • 36
0
votes
2 answers

How to merge more than 1 cell value with a comma in a single cell of a row

I have a 2 tables in SQL Server in which there are multiple locations for a name, all I need to do is to club locations into one cell for that names. Table 1 Name H I J Table 2 Name Location H Delhi H Mumbai H Hyderabad I Chennai I …
IAmHomes
  • 513
  • 2
  • 11
  • 20
-1
votes
1 answer

Add prefix with distinct in group_concat sql

Hey I have this query select group_concat(distinct(accountId) separator "' ,") from xxx_yyy_replacement_instances where deletedAt IS NULL which returns me the next results act-fdf4caf8' ,act-525d62af' ,act-e141e6ab' ,act-73995962' ,act-c782e06d'…
-1
votes
1 answer

How do I use select alias inside GROUP_CONCAT?

I am averaging 4 columns and giving an alias score. Now, I am trying to use score alias inside GROUP_CONCAT to get rank. Everything works except when I add (SELECT GROUP_CONCAT( score ORDER BY score DESC) FROM math )) AS rank. I understand it does…
-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

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

How to properly collapse MySQL rows into a single list

I have a query of the form SELECT pub.id, topic.id, pub.title, etc... FROM pub, topic, link WHERE (matching logic) which returns in the form pub.id | topic.id | pub.title --------------------------------- x1 | a | y1 x1 | …
-1
votes
1 answer

Trying to combine multiple rows from a table into one row

I've been trying to figure this out for a little bit now and i keep running into dead ends. Maybe someone here can help me. I work for a company and we are going to be receiving a file for units we are going to repair. In certain situations, we…