Concatentate data from a query into a single row (Transpose)

Let’s say you have a query that returns this cert_id 100 200 300 500 600 What I want is to have it return this in a query cert_id 100,200,300.500,600 After much searching on the topic of transpose, with some complex solutions offered, I stumbled onto the GROUP_CONCAT function in Mysql. So my query looks like this /* Show Gift Cert nubmers */ ( SELECT GROUP_CONCAT(cert_id) FROM ugiftcert_history uh WHERE so.

A handy little SQL statement

Have a look at the following SQL SET @salt=SUBSTRING(MD5(RAND()),-20); This will set a variable called @salt that has a random string of 20 characters.