greenday Posted November 30, 2007 Share Posted November 30, 2007 Hi, i have 2 tables 'articles' and 'articlecategory' they are linked together with articlecategoryid. I want to see each category heading with the latest story summary underneath it: Article Heading 1 Article summary here Article Heading 2 Article summary here Article Heading 3 Article summary here Here is my sql "SELECT DISTINCT articlecategory.articlecategoryname, articles.articlecategoryid, articles.articleid, articles.articlesummary FROM articles, articlecategory WHERE articles.articlecategoryid = articlecategory.articlecategoryid " But I get duplicate article headings for each story that is in it. Any ideas please? Link to comment https://forums.phpfreaks.com/topic/79502-distinct-problems/ Share on other sites More sharing options...
fenway Posted November 30, 2007 Share Posted November 30, 2007 You can't use DISTINCT with multiple columns... especially with IDs... it doesn't make any sense. As for the output, I don't really know what you mean -- you'll get the article category and summary for each one. Link to comment https://forums.phpfreaks.com/topic/79502-distinct-problems/#findComment-402917 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.