sql - MySQL how to return concatenated name and lastname of a user -


i need mysql query return "value" , "label" field name.

i have "value" id of user , "label" "name lastname" or "*name_first_letter lastname*" directly query.

lets have table this:

  • id name lastname
  • 1 john johhanson
  • 2 peter petterson
  • 3 jeff jefferson

i id "value" simple query: select id value. "j. johhanson" or "p. petterson" "label".

update

sorry bothering. tried concat, concat_ws. unsuccessfully, managed results easily. in case query worked needed:

select concat_ws(' ', name, lastname ) users name  "%peter%" 

thank you.

select id                                    value,         concat(left(name, 1), '. ', lastname) label    table;  

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -