
April 13th, 2016, 09:32 AM
|
Registered User
|
|
Join Date: Apr 2016
Posts: 1
Time spent in forums: 7 m 56 sec
Reputation Power: 0
|
|
Joining multiple columns in multiple tables
As a complete beginner thats just been dumped in at the deep end I am tasked with making an sql statement that gets data from multiple tables and multiple columns.
I need a single query that gets a books name from a category and also gets its image, and its author.
See below for the code I have already which allows me to get the image successfully.
PHP Code:
mysql_query('SELECT * FROM t_categories JOIN t_books AND t_authors AND t_publishers ON t_categories.cat_id=t_books.book_cat_id WHERE cat_id=1');
Each author has a numeric value like 1,2,3 etc for each author and the same goes for a category and publiher.
The sql joins and relationships confuse me.
Any assistanc eis very welcome
|