/* Grouping and Concatenating string values for an entire column  */

/* MYSQL and SQLite */

SELECT  vendor,  GROUP_CONCAT(description), SUM(amount)
FROM  payment 
GROUP BY vendor;
		
		
/* MYSQL only */

SELECT  vendor,  GROUP_CONCAT(description ORDER BY description), SUM(amount)
FROM  payment 
GROUP BY vendor;


SELECT  vendor,  GROUP_CONCAT(description ORDER BY description SEPARATOR ',  '), SUM(amount) as "total"
FROM  payment 
GROUP BY vendor;


SELECT lname, fname, GROUP_CONCAT(course_id,'--',class_id ORDER BY course_id desc SEPARATOR ', ') as "courses", COUNT(course_id)   
FROM student JOIN class ON ssn=stu_ssn
GROUP BY lname, fname;