Joining two fields into one

I want to get two fields value in a single value and I searched on net many times but today I try to solve at my behalf and I got the solution. Here you will get the solution to get the two fields value as single value:

For example:

Database :  db_bank
Table :  tbl_customer
Fields :  id,  first_name,  last_name

And you want to get first_name and last_name as CustomerName then,

SQL should be:
SELECT CONCAT( cus.first_name, cus.last_name ) AS CustomerName
FROM `db_bank`.`tbl_customer` AS cus
WHERE cus.`id`=[AnyID]
LIMIT 0,  30


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*