I have 2 tables as such:
StudentID | |
---|---|
1 | him@school.edu |
2 | her@school.edu |
Book Title | Borrowed By (Student ID) | Borrowed Date |
---|---|---|
Some Book | 13 | 10/10/2021 |
Other Book | 456 | 10/15/2021 |
I want to make a single SQL query to return the email of the student and borrowed date for a specific book title.
Something like
SELECT
*
FROM
student_table
WHERE
StudentID = (SELECT
StudentID
FROM
borrowed_table
WHERE
BookTitle = 'Some Book');
but this would only return the Email. I want to return the borrowed date as well. How can I combine the results of both queries?
Can this be done without specifying the columns (UNION of *) ?