Column transfer in mysql, and multiple fields are transferred to one field in a row, separated by commas

Column transfer in mysql, and multiple fields are transferred to one field in a row, separated by commas

 

SELECT
	group_concat(a.id SEPARATOR ',') AS ids
FROM
	(
		SELECT
			*
		FROM
			tablename
		WHERE
			1 = 1
		ORDER BY
			rand()
		LIMIT 10
	) a

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327010256&siteId=291194637