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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:03:20+00:00 2026-05-11T19:03:20+00:00

I have two tables in the system. I’m trying to make a VIEW that

  • 0

I have two tables in the system. I’m trying to make a VIEW that represents them both together, and i’m not sure how this can be done or even IF this can be done.

Pets

PetId INT PK
Name  VARCHAR(100)

PetOtherNames

PetID INT PK FK
Name VARCHAR(100) PK

So, i have a table of pets. The name (in this table) is their formal common name. Each pet maybe have Zero-To-Many other names. These names are never displayed BUT are to be used in a search query.

So, lets look at some data.

Pets Data

1. Fred
2. Barney
3. Foo
4. Megan Fox (boom tish)

PetsOtherName Data

2. B-b-b-Barney
2. Bannana Barney
2. Banannarama
4. TapTap

So … if i make a VIEW of these two tables, i expect the following results….

SELECT *
FROM PetsView
ORDER BY PetId, Name

1. Fred
2. B-b-b-Barney
2. Barney
2. Bannana Barney
2. Banannarama
3. Foo
4. Megan Fox
4. TapTap

And this will then enable me to do the following ….

SELECT PetId, Name
FROM PetsView
WHERE CONTAINS(Name, 'Fox')

… and returns 4. Fox

SELECT PetId, Name
FROM PetsView
WHERE CONTAINS(Name, 'Fox')

… and returns 4. TapTap

cheers 🙂

PS. I’m not sure i worded the title of this post, so please feel free to edit it appropriately (or suggest a better title, for me to update).

Update: This is for sql2008, but i’m assuming the result would be tsql .. so it should/could apply accross the board.

  • 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-11T19:03:21+00:00Added an answer on May 11, 2026 at 7:03 pm

    Create a view that creates a UNION of the two tables:

    CREATE VIEW PetsView AS
    SELECT * FROM Pets
    UNION
    SELECT * FROM PetOtherNames
    
    • 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 are related, which, for the purpose of this question,
I have two tables, Locations and Facilities They map to two classes, public Location
Rails 3 newbie here... I'm working to create a devise auth system that like
I am developing a user feedback system using ASP.NET and C#. I have multiple
Currently I am performing a left join on two tables. The first table has
I want to develop a system where a user should be able to post
I am experienced with Spring, but new to Spring Batch. Now I have the
I am using AspNetSqlMembershipProvider in my ASP .Net 4 web application project. I have
For an application used for managing booktitles and such, I'm using CoolStorage as an
Recently i am started using hibernate. to insert or update i am using saveOrUpdate()

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.