I've got a big problem trying to join 2 tables on 1 tables in mysql
I have 3 tables:
-news
-category
-user
Im trying to take a category name and picture from one table and the username and mail from another table,
youll see:
So far ive produced 2 queries, none of which work.
SELECT
news.newsID,
news.header,
newst.ingress,
news.timestamp,
user.username,
user.mail,
category.name,
category.picUrl
FROM category INNER JOIN (user INNER JOIN news ON user.userID = news.userID) ON category.categoryID = news.categoryID
SELECT
news.newsID,
news.header,
newst.ingress,
news.timestamp,
user.username,
user.mail,
category.name,
category.picUrl
FROM
news,
user,
category
WHERE
news.userID = user.userID
AND
news.categoryID = category.categoryID
the first one give me an error
and the second one just wont return anything, even though ive filled up the tables with enough dummy data to test with.