recset Posted December 25, 2006 Share Posted December 25, 2006 I have two tables. (lets refer them as [b]Table A[/b] and [b]Table B[/b])I am trying to show how many records are in [b]Table B[/b], based off of the record ID of [b]Table A[/b] (the Record ID of Table B will sort Table A)All of this has to appear in a Repeated Region.Here is what I have so far, please help:[code]mysql_select_db($database_vlot, $vlot);$query_ShowComments = "SELECT * FROM comments WHERE WISDOM_ID = (SELECT max(id) FROM wisdom)";$ShowComments = mysql_query($query_ShowComments, $vlot) or die(mysql_error());$row_ShowComments = mysql_fetch_assoc($ShowComments);$totalRows_ShowComments = mysql_num_rows($ShowComments);[/code]Thanks Link to comment https://forums.phpfreaks.com/topic/31788-indexing-a-recordset/ Share on other sites More sharing options...
Barand Posted December 25, 2006 Share Posted December 25, 2006 SELECT a.id, COUNT(*) as numrecsFROM TableA a INNER JOIN TableB b ON a.id = b.id Link to comment https://forums.phpfreaks.com/topic/31788-indexing-a-recordset/#findComment-147428 Share on other sites More sharing options...
recset Posted December 25, 2006 Author Share Posted December 25, 2006 How would I implement that into my current script?[code]mysql_select_db($database_vlot, $vlot);$query_ShowComments = "SELECT * FROM comments WHERE WISDOM_ID = (SELECT max(id) FROM wisdom)";$ShowComments = mysql_query($query_ShowComments, $vlot) or die(mysql_error());$row_ShowComments = mysql_fetch_assoc($ShowComments);$totalRows_ShowComments = mysql_num_rows($ShowComments);[/code]More or less, I do not need to code the 'show record count' in the above piece. Link to comment https://forums.phpfreaks.com/topic/31788-indexing-a-recordset/#findComment-147444 Share on other sites More sharing options...
recset Posted December 26, 2006 Author Share Posted December 26, 2006 Anyone have any ideas??? Link to comment https://forums.phpfreaks.com/topic/31788-indexing-a-recordset/#findComment-147801 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.