How to concatenate columns in a Postgres SELECT?

后端 未结 8 1678
醉酒成梦
醉酒成梦 2020-11-27 13:31

I have two string columns a and b in a table foo.

select a, b from foo returns values a and b<

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 13:39

    CONCAT functions sometimes not work with older postgreSQL version

    see what I used to solve problem without using CONCAT

     u.first_name || ' ' || u.last_name as user,
    

    Or also you can use

     "first_name" || ' ' || "last_name" as user,
    

    in second case I used double quotes for first_name and last_name

    Hope this will be useful, thanks

提交回复
热议问题