How to combine more than two fields with SQL?

I am trying to use CONCAT with SQL to concatenate three fields and get the following error:

Incorrect parameters in calling native 'CONCAT' function

The request is as follows

SELECT CONCAT(guests.lastname,', ',guests.firstname', ',guests.passport) AS display FROM guests WHERE guests.uuid = '1' 

How do you combine more than two fields in SQL?

+6
sql mysql
source share
2 answers

You must put commas between all arguments.

Edit:

  SELECT CONCAT(guests.lastname,', ',guests.firstname', ',guests.passport) 

in

  SELECT CONCAT(guests.lastname,', ',guests.firstname,', ',guests.passport) ^ 
+20
source share
 SELECT CONCAT(guests.lastname,concat(', ',concat(guests.firstname,concat(', ',guests.passport)))); 
0
source share

All Articles