Custom functions used in Google Sheets for ease of use and improved functionality.
SELECT BookSales.A, BookSales.C, BookSales.D, Books.B, Books.C
from BookSales
inner join Books on BookSales.B = Books.A
={ArrayFormula(Split(Query(Flatten(IF(BookSales!B2:B=Split(Textjoin("!",1,Books!A2:A),"!"),
IF(BookSales!A2:A <> "",BookSales!A2:A, " ")&"!"&
IF(BookSales!C2:C <> "",BookSales!C2:C, " ")&"!"&
IF(BookSales!D2:D <> "",BookSales!D2:D, " ") &"!"&
Split(Textjoin("!",1,Books!B2:B),"!")&"!"&
Split(Textjoin("!",1,Books!C2:C),"!"),)),"Where Col1!=''"),"!"))
}
select A, B, C, D, E, F from Books where A in (select B from BookSales)
=QUERY(Books!A2:F, "SELECT A, B, C, D, E, F WHERE A MATCHES '"&TEXTJOIN("|", true, QUERY(BookSales!A2:F, "SELECT B"))&"'")