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
It could be done in a single query using union: