Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 761927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:53:48+00:00 2026-05-14T15:53:48+00:00

I have 2 tables that look like this: Table public.phone_lists Column | Type |

  • 0

I have 2 tables that look like this:

    Table "public.phone_lists"
  Column  |       Type        |                             Modifiers                              
----------+-------------------+--------------------------------------------------------------------
 id       | integer           | not null default nextval(('"phone_lists_id_seq"'::text)::regclass)
 list_id  | integer           | not null
 sequence | integer           | not null
 phone    | character varying | 
 name     | character varying | 

and

Table "public.email_lists"
 Column  |       Type        |                             Modifiers                              
---------+-------------------+--------------------------------------------------------------------
 id      | integer           | not null default nextval(('"email_lists_id_seq"'::text)::regclass)
 list_id | integer           | not null
 email   | character varying | 

I’m trying to get the list_id, phone, and emails out of the tables in one table. I’m looking for an output like:

list_id |    phone    |             email              
---------+-------------+--------------------------------
       0 |             | jqeron@wqwerweper.com
       0 |             | qwerox@wqwekeeper.com
       0 |             | erreon@fdfdeper.com
       0 |             | sfar@weasdfer.com
       0 |             | rawq@gdfefdgheper.com
       1 | 15555555555 | 
       1 | 15555551806 | 
       1 | 15555555508 | 
       1 | 15055555506 | 
       1 | 15055555558 | 
       1 |             | rfoasdfx@wefdaser.com
       1 |             | radfy@wfdfder.com

I’ve come up with

select pl.list_id, pl.phone, el.email from phone_lists as pl left join email_lists as el using (list_id);

but thats not quite right. Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:53:48+00:00Added an answer on May 14, 2026 at 3:53 pm
    SELECT  list_id, phone, email
    FROM    (
            SELECT  list_id, NULL AS phone, email, 1 AS set_id
            FROM    email_lists
            UNION ALL
            SELECT  list_id, phone, NULL AS email, 2 AS set_id
            FROM    phone_lists
            ) q
    ORDER BY
            list_id, set_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables that look like this: Table: cases id name status case_no
I have 3 tables that look like this: tblVideo: VideoID | Video Name 1
I have Hibernate Entities that look something like this (getters and setters left out):
In my database I have tables that define types for example Table: Publication Types
I have three tables like that: Articles IdArticle Title Content Tags IdTag TagName ContentTag
I have a few tables that have similar fields but not exactly the same.
I have a few tables that I've defined like the below examples: class TableA
Say I have two tables, user and comment . They have table definitions that
I have two tables that are joined together. A has many B Normally you
I have some tables that I build as a part of my report rollup.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.