Concatenate the values of multiple queried columns into a string bitsCN.com using SQL.
Concatenate the values of multiple queried columns into a string using SQL.
MySQL:
[SQL]
-- Concatenate a single column. first, locate a row, add a comma, and then splice the next row.
Select group_concat (E. SUPPORT)
From ENGINES E
Where E. xa in ('yes', 'no ')
-- The result is as follows: YES, YES, DEFAULT, YES
-- Replace ",", and "**" in the query result
Select REPLACE (group_concat (E. SUPPORT ),',','**')
From ENGINES E
Where E. xa in ('yes', 'no ')
-- The result is as follows: YES ** DEFAULT ** YES
-- Remove duplicate records from the query results, with only one record left, and then splice
Select group_concat (DISTINCT (E. SUPPORT ))
From ENGINES E
Where E. xa in ('yes', 'no ')
-- The result is as follows: YES, DEFAULT
-- Concatenates multiple columns, concatenates the same row first, and then concatenates the next row with a comma.
Select group_concat (E. ENGINE, E. SUPPORT)
From ENGINES E
Where E. xa in ('yes', 'no ')
-- The result is as follows: MRG_MYISAMYES, MyISAMYES, BLACKHOLEYES, CSVYES, MEMORYYES, ARCHIVEYES, InnoDBDEFAULT, cece_schemayes
BitsCN.com