'How to get all columns in PostgreSQL along with CONCATing two columns?
So i am joining these two tables A and B B contains first_name and last_name So i am writing query like this
select col1,col2,...,col12,CONCAT(first_name,last_name) as NAME
from A
INNER JOIN B on A.email=B.email;
Now i want all columns from this query but instead of writing all column names...are there any ways to get every column along with concatenation of these two first_name and last_name?
Solution 1:[1]
Use *
select *, CONCAT(first_name,last_name) as NAME
from A
INNER JOIN B on A.email=B.email;
If you want to get the join column only once, you can use:
select *, CONCAT(first_name,last_name) as NAME
from A
INNER JOIN B using (email);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | a_horse_with_no_name |
