Home > Blockchain >  How can I get contact first name and last name in the same column?
How can I get contact first name and last name in the same column?

Time:09-22

How can I get contact first name and last name in the same column as shown in the picture? Here is my incomplete query:

SELECT
    customernumber,
    customername,
    contactfirstname,
    contactlastname
FROM
    dbs211_customers
WHERE
    country = 'Canada'
ORDER BY
    customernumber;

Here is the link for img: https://i.stack.imgur.com/5e5C2.png

CodePudding user response:

just use concatenation

SELECT customernumber, customername, CONCAT(conctractfirstname, ' ', contractlastname) as `contract_fullname` FROM dbs211_customers WHERE country = 'Canada' ORDER BY customernumber;

CodePudding user response:

There's no picture shown in your question.

But assuming you're asking for something like this:

SELECT customernumber,
(contactfirstname   ' '   contactlastname) AS ContactFullName
FROM dbs211_customers
WHERE country = 'Canada'
ORDER BY customernumber;

CodePudding user response:

SELECT
    customernumber,
    customername,
    concat(concat(contactlastname, ', '), contactfirstname) as "Contact Name"
FROM
    dbs211_customers
WHERE
    country = 'Canada'
ORDER BY
    customernumber;
  • Related