Wednesday, 14 August 2013

Joining columns of one row as a single ouput in MySQL

Joining columns of one row as a single ouput in MySQL

In member table I have separated the first, middle and last name:
id,firstname,middlename,lastname,role,photo
How can I pull out complete name with one query? I tried AS keyword but I
dont know how to aggregate those 3 columns in one:
SELECT id,lastname AS name FROM members ORDER BY role
For example I want to pull out the whole name as name with ofcourse space
between the words:

No comments:

Post a Comment