Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading