SELECT id, <X> AS name FROM `table`
Basically <X> is a combination of
lastname + ‘, ‘ + firstname
example would be
id | name |
2 | Smith, Bob |
3 | Jones, Susy |
This is just an example, I don’t really want to combine names so simple.
What about the
CONCAT()function?If you are going to concatenate many fields, you could also consider the
CONCAT_WS()function, where the first argument is the separator for the rest of the arguments, which is added between the strings to be concatenated: