Search
 
SCRIPT & CODE EXAMPLE
 

SQL

get comma separated values in mysql with group by

SELECT p.id, p.name, GROUP_CONCAT(s.name) AS site_list
FROM sites s
INNER JOIN publications p ON(s.id = p.site_id)
GROUP BY p.id, p.name;
Comment

PREVIOUS NEXT
Code Example
Sql :: sql server fn_dblog 
Sql :: top frequency in sql server 
Sql :: Postgres format number to 2 decimal places 
Sql :: postgres add prefix to primary key 
Sql :: order of execution in sql 
Sql :: tsql generate rows 
Sql :: sql cte example 
Sql :: tsql from yyyymm to date 
Sql :: compression of dabatase mysqldumo 
Sql :: mysql pass command from command line 
Sql :: update from select postgresql 
Sql :: oracle undo usage per session 
Sql :: To log postgres db in without a password 
Sql :: how to connect sqlalchemy to mysql and deploy it 
Sql :: sqlalchemy existing db file 
Sql :: sql server inner join 
Sql :: what is top n result in sql 
Sql :: create a table from one field of another table 
Sql :: example database query 
Sql :: sql convert int to string 
Sql :: can you put a break command in sql 
Sql :: get first match in each group mysql query 
Sql :: table users 
Sql :: sql xor 
Sql :: sql case sttement with set 
Sql :: _ Wildcard in SQL 
Sql :: mysql workbench primary key 
Sql :: sqlalchemy _in array sqlite 
Sql :: oracle multiple insert 
Sql :: identity column in sql server 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =