I have 4 tables [users, ads, subcategories, and categories].
Each record in the ads table has:
- A userID number associated with a userUID in the users table
A categoryID associated with a categoryID in the categories table
A subcategoryID associated with a subcategoryID in the subcategories table
I'm trying to display all ads with their respective category and subcategory names, but when I try this code, no records are returned:
Code: Select all
SELECT `userUID`, `adID`, `adTitle`,
`adCategoryID`, `adSubcategoryID`, `catName`, `subcatName`
FROM users, ads, categories, subcategories
WHERE (users.userID = ads.adUser)
AND (ads.adCategoryID = categories.catID)
AND (ads.adSubcategoryID = subcategories.subcatID)
LIMIT 10Mahalo!