I am using two select statments in a php page as follows:
$num1 = mysql_query("SELECT SId FROM mtable WHERE Pathogen='$pathogen1' && Topic='$topic1' && Indicator='$ind1' && IndicatorSubGroup='$subind1' ");
and
$num2 = mysql_query("SELECT SId FROM mtable WHERE Pathogen='$pathogen2' && Topic='$topic2' && Indicator='$ind2' && IndicatorSubGroup='$subind2' ");
at present the result is displayed using separate while loops as follows
while($nval= mysql_fetch_array($num1))
{
$vv=$nval['SId'];
$result = mysql_query("SELECT * FROM mtable WHERE SId='$vv'");
while($row = mysql_fetch_array($result))
{
print "<tr height='18'>";
print "<td width=200 align=left>" . $row['Country'] . "</td>";
print "<td width=70 align=center>" . $row['MidEstimate'] . "</td>";
print "<td width=70 align=center>" . $row['LowEstimate'] . "</td>";
print "<td width=70 align=center>" . $row['HighEstimate'] . "</td>";
print "<td width=89 align=center>" . $row['StudyLocation'] . "</td>";
print "<td width=139 align=center>" . $row['ReferenceID'] . "</td>";
print "<td width=89 align=center>" . $row['Quality'] . "</td>";
print "<td width=89 align=center>" . $row['Relevance'] . "</td>";
print "<td width=61><a href='/sites/default/files/popupboxCD.php?SId=$vv' onClick='openpopup(this.href);return false;'>".$row['Info']."</a></td>";
print "</tr>";
print "<tr height='1'><td colspan='9' style='padding:0'><hr size='0.5' color='#CCCCCC' noshade='noshade' /></td></tr>";
}
}
and
$num2 = mysql_query("SELECT SId FROM mtable WHERE Pathogen='$pathogen2' && Topic='$topic2' && Indicator='$ind2' && IndicatorSubGroup='$subind2' ");
print $num2;
print "<table border='0' width='875' align='center'>
<tr><td colspan=5 height=10></td></tr>
<tr>
<td width='200' bgcolor='#99CCF5' align='center'><b>Country</b></td>
<td width='70' bgcolor='#99CCF5' align='center'><b>Mid</b></td>
<td width='70' bgcolor='#99CCF5' align='center'><b>Low</b></td>
<td width='70' bgcolor='#99CCF5' align='center'><b>High</b></td>
<td width='89' bgcolor='#99CCF5' align='center'><b>Study Location</b></td>
<td width='139' bgcolor='#99CCF5' align='center'><b>Reference</b></td>
<td width='89' bgcolor='#99CCF5' align='center'><b>Quality</b></td>
<td width='89' bgcolor='#99CCF5' align='center'><b>Relevance</b></td>
<td width='61' ></td>
</tr>";
while($nval= mysql_fetch_array($num2))
{
$vv=$nval['SId'];
$result = mysql_query("SELECT * FROM mtable WHERE SId='$vv'");
while($row = mysql_fetch_array($result))
{
print "<tr height='18'>";
print "<td width=200 align=left>" . $row['Country'] . "</td>";
print "<td width=70 align=center>" . $row['MidEstimate'] . "</td>";
print "<td width=70 align=center>" . $row['LowEstimate'] . "</td>";
print "<td width=70 align=center>" . $row['HighEstimate'] . "</td>";
print "<td width=89 align=center>" . $row['StudyLocation'] . "</td>";
print "<td width=139 align=center>" . $row['ReferenceID'] . "</td>";
print "<td width=89 align=center>" . $row['Quality'] . "</td>";
print "<td width=89 align=center>" . $row['Relevance'] . "</td>";
print "<td width=61><a href='/sites/default/files/popupboxCD.php?SId=$vv' onClick='openpopup(this.href);return false;'>".$row['Info']."</a></td>";
print "</tr>";
print "<tr height='1'><td colspan='9' style='padding:0'><hr size='0.5' color='#CCCCCC' noshade='noshade' /></td></tr>";
}
}
I would like to know if there's any way to merge these two table into single table?
The result should look like this:
Value1(common to both query., eg.country), Value2(from 1st query), Value2(from 2nd query)
I got only a single table in mysql which both query show results.
I am sorry my question confuses all. I am Lotus Notes Developer and not a PHP. So I am only a novice user in sql.
Here I repeat my query again...
At present I got two tables display result from two queries from a single table. I want to mix these result in a single table ?
That is my new table must have three columns. First with common value from both tabels and second column from first table second column and third column from second table second column. Second and third column in new table is dispalying data from same column from the main mysql data.
Hope this makes much better, thanx for all the suggestion. I will try this myself and if get succeed I will post it here.