Avatar of Newton
Newton
 asked on

Join multiple sql in postgresql

I have below 3 sql but I need 1 sql that can show all 3 result as 1 output

Sql : select current_database();
Output : dbname

Sql : select inet_server_addr();
Output : 101.99.234.20

Sql : select user;
Output : userA

Above is 3 different output but I need 1 sql that can give 1 output like below.

Output
Current_database,ip,user
Dbname, 101.99.234.20, userA

Is it possible to join these sql.
PostgreSQLSQL

Avatar of undefined
Last Comment
Newton

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ryan Chong

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
strivoli

Create a VIEW that "collects" data from the 3 Tables.
Peter Chan

Use Union all to combine all 3 queries.
Newton

ASKER
Thank You Ryan. My problem solved.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck