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 855729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:07:29+00:00 2026-05-15T08:07:29+00:00

I have several different tables, but they all have 2 columns that are the

  • 0

I have several different tables, but they all have 2 columns that are the same name. I want to write a stored procedure that searches one column in all of the tables and returns the result. Ideas? I’m fairly nub when it comes to SQL.

  • 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-15T08:07:30+00:00Added an answer on May 15, 2026 at 8:07 am

    The operation you are looking for is UNION or UNION ALL.

    SELECT * FROM (
     SELECT col1, col2 FROM table1
     UNION ALL
     SELECT col1, col2 FROM table2
     UNION ALL
     SELECT col1, col2 FROM table3
    ) all_tables
    WHERE all_tables.col1 = 'something'
    

    If you use UNION rather than UNION ALL, the database will eliminate duplicate rows that may be in multiple tables. If you know there won’t be any duplicates, use UNION ALL since it is generally much faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several different lists I want to call. They all have the same
In my game application I have several different activities that all can be accessed
I have several different numbers in a group that range in sizes and would
I have several different content type nodes (videos, image galleries, stories...) that I would
I have several xml files with different node structure. I want to extract xml
I want a chart that has several separate series running in rows across. They
I have several hosts from which i want to do the same query. So
I read about several different solutions to simulate equal-height columns or elements, but none
Hi i'm trying to create a league table in which i have several different
I have several objects of different kinds (different function names, different signatures) and I

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.