user2009265
user2009265

Reputation: 23

How to concat two columns

I need to concat two columns firstname and lastname as name in a crosstab select, example:

select * from crosstab('SELECT concat(u.firstname," ",u.lastname)as name

But I get this error:

column  « » doesn't exist.

How can I do it?

Upvotes: 2

Views: 7695

Answers (2)

Robert N
Robert N

Reputation: 1174

Try this:

select * from crosstab('SELECT  concat(u.firstname,'' '',u.lastname) as name')

I added a missing "close quote" at the end of your crosstab string, and I doubled-up the single quotes to escape them within that string.

Upvotes: 1

Houari
Houari

Reputation: 5621

Replace double quote by simple quote like:

SELECT concat(u.firstname,' ',u.lastname)

Upvotes: 2

Related Questions