To create an sql query to replace the id at their values from other tables?

5dfb63b75055d321563046.png
Fails to make a request for withdrawal with the replacement of id values from other tables
"SELECT Author,Name,book.Genre,book.Publishing,Year,Tom,book.Acquired,Cost,FIO,Prima
 FROM (publishing INNER JOIN genre ON book.Genre = genre.idGenre) INNER JOIN customer ON book.Publishing = publishing.idPublishing";
April 3rd 20 at 18:41
1 answer
April 3rd 20 at 18:43
To take values from other tables you need and take them from other tables) But here everything from the book.

SELECT Author, Name, genre.Genre publishing.Publishing, Year, Tom, book.Acquired, Cost, FIO, Prima


To avoid confusion, a good thing would be to call different data different names. ID-shki genre_id and genre_name nazvaniya, for example
does not work( the full query can help make? - Ramon.Purdy commented on April 3rd 20 at 18:46
SELECT Author, Name, genre.Genre publishing.Publishing, Year, Tom, book.Acquired, Cost, FIO, Prima FROM INNER JOIN genre ON book.Genre = genre.idGenre INNER JOIN customer ON book.Publishing = publishing.idPublishing INNER JOIN genre ON book.Acquired = acquired.idAcquired
- Ramon.Purdy commented on April 3rd 20 at 18:49
now table book disappeared from the sample)

SELECT Author, Name, genre.Genre publishing.Publishing, Year, Tom, acquired.Acquired, Cost, FIO, Prima 
FROM book
INNER JOIN genre ON book.Genre = genre.idGenre 
INNER JOIN customer ON book.Publishing = publishing.idPublishing 
INNER JOIN genre ON book.Acquired = acquired.idAcquired
- Frederik.Boehm commented on April 3rd 20 at 18:52
5dfc98c85f944864366168.png
maybe the fact that output through printf because of this not displayed ?
and why customer ?and not the name of the table from which to draw?) - Ramon.Purdy commented on April 3rd 20 at 18:55
@Frederik.Boehm, the request is made all works
SELECT Author,Name,genre.Genre publishing.Publishing,Year,Tom,acquired.Acquired,Cost,FIO,Prima
 FROM book
 INNER JOIN genre ON book.Genre = genre.idGenre
 INNER JOIN ON book publishing.Publishing = publishing.idPublishing
 INNER JOIN ON acquired book.Acquired = acquired.idAcquired

but appears to have ceased)
UPD was replaced in printf integer %d but there are zeros ( - Ramon.Purdy commented on April 3rd 20 at 18:58
5dfc9bf2b074e370742783.png5dfc9bf7a45a2622695479.png
all done, thank you ) - Ramon.Purdy commented on April 3rd 20 at 19:01

Find more questions by tags MySQLSQL