How can I concatenate all the rows in single rows when I fire SELECT query?
You'll need GROUP_CONCAT and CONCAT mysql functions and the query should look like this:
SELECT GROUP_CONCAT( CONCAT( id, ' ', name, ' ', city, ' ', state) SEPARATOR ' ')
FROM students
GROUP BY (1)
Or you can use CONCAT_WS instead:
CONCAT_WS(' ', id, name, city, state)
Use conbination of group_concat
and concat
functions
SELECT group_concat( concat( id, " ",name," ",city," ",state," " ) SEPARATOR ' ')
FROM tablename