60 questions
-2
votes
2
answers
78
views
Find the genres that have at least 2 same directors, then print common genres and director id?
The dataset is like this:
g1 = {d1,d3,d5}
g2 = {d1,d3,d2}
g3 = {d4,d3,d5}
I have the following table called director_genre:
director_id | genre
d1 g1
d1 ...
0
votes
1
answer
330
views
How do you order the results of mySQL group_concat() when all the values come from one column?
I have a simple table that has 3 columns: id, variable, and value. There are a lot of user IDs and a lot of different variables per person too (all the specs from their profiles to be exact), but I ...
-1
votes
1
answer
403
views
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' ,...
0
votes
1
answer
134
views
MYSQL - Concatenating two group concat functions into a list
So i'm working with this data set based on a sneaker store, and what i need to do, is to get rid of duplicate fields containing shoe models that only differ in size.
What i'm trying to do, is to merge ...
1
vote
2
answers
4k
views
Group by with comma-separated values and excluding the value from the previous column value
I have two tables Lecturer and Student and I would like to display the other lecturer id's in the new column with comma separated values. I am using SQL Server 2014.
Table: Lecturer
id name ...
1
vote
2
answers
810
views
In SQL, create pairs based on a grouping and count their frequency
What I want is to create DISTINCT pairs of column 2 for each ID and arrange them by count.
Let's use this table as an example:
CREATE TABLE mytable
(`ID` int, `C2` varchar(1), `C3` varchar(2))
;
...
0
votes
2
answers
84
views
How to use GROUP_CONCAT on multiple JOIN
I am currently retrieving data from multiple tables using a cus_id as the initial query. From here I have multiple tables that can have various rows of data that I would like to retrieve and use ...
-1
votes
1
answer
249
views
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 ...
1
vote
1
answer
2k
views
Why setting the group_concat_max_len variable in a query results in an error in PHP's bind_param()?
I have the following query:
$query = <<<SQL
SELECT
year,
count(*) AS `counter`,
GROUP_CONCAT(team) AS `team_list`
FROM
team_list
WHERE year IS NOT NULL ...
1
vote
2
answers
3k
views
Using STUFF with DATE
I am trying to use the STUFF functionality in SQL Server 2016 to select DATE information and return it to a table. Occasionally there are multiple dates to return. I have already used STUFF to get ...
0
votes
1
answer
335
views
GROUP_CONCAT in SQL Server error
Error:Column 'ReviewConsultants.ConsultantID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Query:
select
R.ReviewID,
...
1
vote
1
answer
484
views
Group_Concat in pairs of nth
I have a query that I normally group_concat. I need to know if dbo.group_concat has the ability to pair the result of a query into pairs of 3 (as an example).
For example:
select size, pattern, dbo....
0
votes
1
answer
1k
views
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 ...
8
votes
3
answers
11k
views
How to execute a query which is stored in a table column MySQL?
mysql> select * from CT;
| CID | MID | REPORT_QUERY |
| 1 | 1 | select * from emp; |
| 2 | 2 | select * from student; |
2 rows in set (0.00 sec)
I want to execute queries in ...
3
votes
3
answers
5k
views
Multiple rows to one comma-separated value different ID
This question already has an answer here:
Multiple rows to one comma-separated value [duplicate] 1 Answer
I want to create a table valued function in SQL Server, which I want to return data in comma ...