I’m trying to create a list of all our employees by last
name with their dependents by first name, and birth dates. My output columns
are emp_last_name from the employee table and dep_name and dep_date_of_birth.
Here is what I’ve specifically been tasked with doing:
Use alias table names.
Name each column appropriately
Sort the result table by emp_last_name.
Use the CAST statement to produce a listing that
fits easily on one page.
To make matters worse, I’m teaching myself SQL Server to do
this. My code so far is as follows:
SELECT emp_last_name"Employee Last Name",
CAST(dep_date_of_birth as char(12))"Dependent Date of Birth"
from employee dependent
ORDER BY emp_last_name;
I cannot figure out
how to join it because there are so many dependents with the same last name.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!