Skip to content
Advertisement

How to display values from different tables in certain time frame MYSQL

I have attached the tables that are included in this question for MYSql. My question states:

First and last names of the top 5 authors clients borrowed in 2017. My code so far:

I think so far my code just displays the top 5 Author ID in 2017 but I can’t figure out how to display the names. I see the link between AuthorID and BookAuthor (maybe). Thank you so much for any help you may provide.

Here are the tables:

enter image description here

Advertisement

Answer

You can bring the client table with a join. I think that you want:

This treats borrowDate as a column of type date (or the-like), because that what it seems to be. If it just a number that represent the year, then you can change back the where clause to your original condition.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement