graham23s Posted November 14, 2009 Share Posted November 14, 2009 Hi Guys, I can't remember the query i need here lol, basically in my master logs table i have: ID | PRODUCT_ID | CART_ID | DATE 1 | 23 | 1234 | 11/10 2 | 27 | 1235 | 12/10 3 | 27 1236 | 12/10 i'm trying to group together the number product id's so i can keep track of the number sold of that product i forget the query though. thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/181485-query-for-grouping-products/ Share on other sites More sharing options...
joquius Posted November 14, 2009 Share Posted November 14, 2009 SELECT DISTINCT(`PRODUCT_ID`) FROM `table`; ? Link to comment https://forums.phpfreaks.com/topic/181485-query-for-grouping-products/#findComment-957352 Share on other sites More sharing options...
graham23s Posted November 14, 2009 Author Share Posted November 14, 2009 Hi Mate, That's the one i remembered after i posted i usually code in vb.net haven't done php in a while i have: $qQ1 = "SELECT DISTINCT 'PRODUCT_ID' FROM `fcp_orders_master_log` GROUP BY `uniqueCount` LIMIT $num, $max"; $rQ1 = mysql_query($qQ1); $numResultsWithClause = mysql_num_rows($rQ1); $test = $aQ1['uniqueCount']; print $test; But it's not printing me anything, the syntax seems ok. cheers Graham Link to comment https://forums.phpfreaks.com/topic/181485-query-for-grouping-products/#findComment-957358 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.