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

  • SEARCH
  • Home
  • 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 3634906
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:50:15+00:00 2026-05-19T00:50:15+00:00

HI, I have a database with 3 tables TAB1, TAB2, TAB3 which have exactly

  • 0

HI,

I have a database with 3 tables TAB1, TAB2, TAB3 which have exactly the same columns, for example :

TAB1
cola, colb, colc, cold
TABB
cola, colb, colc, cold
...

Now I would like to search all distinct “colb” values, this is the query :

SELECT DISTINCT colb FROM TAB1

Works perfectly but now I would search all distinct “colb” values in my 3 tables “TAB1”, “TAB2”, “TAB3” :

SELECT DISTINCT colb FROM TAB1, TAB2, TAB3

And now SQL return me an error: “Column ‘colb’ in field list is ambiguous”
After some search, I understood that was because ‘colb’ column exist in my 3 tables.

So how search in my 3 tables a distinct value from the same column ? I cannot use the LEFT JOIN because I wan to search in my all 3 tables and not in one of them.

Do you have an idea ? Thanks

  • 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-19T00:50:15+00:00Added an answer on May 19, 2026 at 12:50 am

    This single query with union will take care of distinct values for you.

    select colb from tab1 union
      select colb from tab2 union
      select colb from tab3;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a collection of database tables (in an Access file, for example)
In my database I have tables that define types for example Table: Publication Types
I have designed database tables (normalised, on an MS SQL server) and created a
I have database with many tables. In the first table, I have a field
I have a database with two tables ( Table1 and Table2 ). They both
I have a database with 2 tables. One of the tables holds a row
i have in the database typical tables like user, usergroup, and they have relations.
I have a Linux web server and I'd like to make some database tables
I have an SQL database with multiple tables, and I am working on creating
I have an access database with 3 tables. People Gifts PeopleGifts Using VS 2008,

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.