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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
The operation you are looking for is
UNIONorUNION ALL.If you use
UNIONrather thanUNION ALL, the database will eliminate duplicate rows that may be in multiple tables. If you know there won’t be any duplicates, useUNION ALLsince it is generally much faster.