# Question about queries

**URL:** <https://forum.kirupa.com/t/question-about-queries/282217>\
**Category:** Uncategorized\
**Created:** [February 19, 2009, 3:47am UTC](https://forum.kirupa.com/t/question-about-queries/282217 "2009-02-19T03:47:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkfox](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@darkfox](https://forum.kirupa.com/u/darkfox)\
**Post date:** [February 19, 2009, 3:47am UTC](https://forum.kirupa.com/t/question-about-queries/282217/1 "2009-02-19T03:47:48Z")

</div>

Hi, been trying to learn MySQL and bumped into this problem

I’m having some trouble on running both queries under the same table

how to I make sure result2 gets inputted into the table too?

then it becomes

Month | Total | Win  
January| (the field\_1) | (the field\_2)

cause it gives me blank =(

thx in advance

```auto

 <b>Data</b>
  <table width="50%" align="center">
    <tr class="style2"><td align="center">Month</td>
    <td align="center">Total</td>
    <td align="center">Win</td>
    <td align="center">Draw</td>
    <td align="center">Lose</td>
    <td align="center">Percet</td>
     <td align="center">History</td>
    </tr>
 <?php
$connection = mysql_connect("host", "user", "pw") or die("Error connecting to database");
mysql_select_db("mahjong", $connection);
$result = mysql_query("SELECT COUNT( match.`Date` ) AS FIELD_1
FROM match
WHERE (
Date LIKE '01-%'
)", $connection) or die("error querying database");

$result2 = mysql_query("SELECT COUNT( match.`Result` ) AS FIELD_2
FROM match
WHERE 
(Date LIKE '01-%') AND
(Result = 'Win')", $connection) or die("error querying database");

$i = 0;
while($result_ar = mysql_fetch_assoc($result)){

?>

    <tr <?php if($i%2 == 1){ echo "class='bodyb'"; }else{echo "class='bodya'";}?>>
    <td align="center">
    January
    </td>
      <td align="center">
      <?php echo $result_ar['FIELD_1']; ?></td>
      <td align="center">
      <?php echo $result2['FIELD_2']; ?></td>
 <?php
$i+=1;
}
?> </tr>
  </table>    

```
