peterg0123 Posted September 26, 2010 Share Posted September 26, 2010 Hi, I am very new to mysql scripting and I am trying to write a query using joins. The problem is that I only returns 1 row everytime where the categoryId = 29. There are definetly other rows that should be returned? Any help would be great... SELECT tbl_posts.id, tbl_posts.name, tbl_posts.description,tbl_posts.webUrl, tbl_posts.emailAddress, tbl_posts.telNumber,tbl_posts.provinceId, tbl_posts.cityId,tbl_posts.creationDate, tbl_posts.activated,tbl_post_categories.categoryId,tbl_provinces.name as provinceName, tbl_cities.name as cityName, tbl_categories.name as categoryName FROM tbl_posts JOIN tbl_post_categories ON tbl_posts.Id = tbl_post_categories.postId JOIN tbl_categories ON tbl_post_categories.categoryId = tbl_categories.id JOIN tbl_provinces ON tbl_posts.provinceId = tbl_provinces.id JOIN tbl_cities ON tbl_posts.cityId = tbl_cities.id WHERE tbl_post_categories.categoryId ='29' Thanks in advance, Peter Link to comment https://forums.phpfreaks.com/topic/214418-mysql-joins/ Share on other sites More sharing options...
kickstart Posted September 26, 2010 Share Posted September 26, 2010 Hi I would suspect that while there might be other rows that match they don't have matching rows on the tables you are joining to. All the best Keith Link to comment https://forums.phpfreaks.com/topic/214418-mysql-joins/#findComment-1115824 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.