greenday Posted January 23, 2008 Share Posted January 23, 2008 Hi, here is my sql staement: SELECT * FROM articlecategory, articles WHERE articles.articlecategoryid = articlecategory.articlecategoryid And here I echo this in a while loop: <?php echo $row_news['articlecategoryname']; ?></strong><br> <?php echo $row_news['articlesummary']; ?></p> Trouble is I only want 1 article suammary under each article category heading, and i am getting all the results. Any ideas please? Link to comment https://forums.phpfreaks.com/topic/87297-query-help/ Share on other sites More sharing options...
priti Posted January 23, 2008 Share Posted January 23, 2008 You can groupBY on articlecategory and get the summary .Are you having multiple summary for article category?? Regards Link to comment https://forums.phpfreaks.com/topic/87297-query-help/#findComment-446668 Share on other sites More sharing options...
greenday Posted January 23, 2008 Author Share Posted January 23, 2008 Thanks for your reply. I would like the out put to look like Article Category Title Article Summary And this is repeated, one article summary underneath each differant article title. How could i use group by to achieve this - i have only used it to count? Thanks. Link to comment https://forums.phpfreaks.com/topic/87297-query-help/#findComment-446755 Share on other sites More sharing options...
priti Posted January 23, 2008 Share Posted January 23, 2008 Hi, i thought you would tell me some example with dummy data shell i consider something like below article1 first category artic article1 second article summary article2 second arti article2 second article summary second article article1 dirst category art second artieldf article2 summary of articel two ???? Regards Link to comment https://forums.phpfreaks.com/topic/87297-query-help/#findComment-446876 Share on other sites More sharing options...
greenday Posted January 23, 2008 Author Share Posted January 23, 2008 ok sorry its like this: Category 1 Heading First article in category 1 Category 2 Heading First article in category 2 Category 3 Heading First article in category 3 .. and so on. Cheers Link to comment https://forums.phpfreaks.com/topic/87297-query-help/#findComment-447180 Share on other sites More sharing options...
priti Posted January 24, 2008 Share Posted January 24, 2008 hi greenday, well i tried one query to help you i.e SELECT asummary FROM `article` group by (aTitle) it showed me one article per category.just give a try and let me know weather it solves your problem or not.which server side scripting you are using to show the result?? PHP? Regards Link to comment https://forums.phpfreaks.com/topic/87297-query-help/#findComment-447533 Share on other sites More sharing options...
fenway Posted January 24, 2008 Share Posted January 24, 2008 This is a double-post....topic locked. Link to comment https://forums.phpfreaks.com/topic/87297-query-help/#findComment-447997 Share on other sites More sharing options...
Recommended Posts