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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:18:11+00:00 2026-06-02T00:18:11+00:00

I am creating a personnel database and have multiple tables relating to a user

  • 0

I am creating a personnel database and have multiple tables relating to a user that include things like medical examinations, passports, vaccinations, memberships etc.

Each of these tables contains an expiry record which I want to query all tables on. Basically I want to have a list of items that are going to expire in a certain time, something like:

John - Passport expires in 1 month
Emma - Vaccination expires in 1 month
Carol - Vaccination expires in 3 weeks
Josh - Medical expires in 2 weeks
James - Passport expires in 3 days

What is the best way to do this, can it somehow be done in a single query?

Thanks in advance

  • 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-06-02T00:18:14+00:00Added an answer on June 2, 2026 at 12:18 am

    It could be done in a single query using union:

    (SELECT name, 'passport', expiry_date FROM table_passport WHERE ...) 
    UNION ALL 
    (SELECT name, 'vaccination', expiry_date FROM table_vaccinations WHERE ...) 
    UNION ALL 
    (SELECT name, 'medical', expiry_date FROM table_medical WHERE ...) 
    ORDER BY name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables: Personnel with ID,Name,... columns and User with PersonnelID (FK of
I am creating a portfolio page for m personal site. I have a slider
I am creating a portfolio page for m personal site. I have a slider
I am creating a small rails app for personal use and would like to
I'm creating a web application that will use a lot of ajax calls. The
I'm creating a personal site to showcase demo material, and I would like to
let's get some different points of view about this situation I have. I'm creating
I was creating a C# method in visual studio that contained only a switch
I am creating a FileFinder class, where you can do a search like this:
I've noticed that when creating a GUI using Tkinter in python, when running the

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.