表名:
ka_ta结构内容
id-riqi--cla1-cla2-cla3-sum_m
1-2010111-a----b----c----123
2-2010111-a----b----c----125
3-2010111-a----b----c----111
4-2010122-a----b----c----126
5-2010123-a----b----c----135
6-2010125-a----b----c----126<label for="111"></label>
   <select name="111" id="111">
   </select> <?php                                                                      
$exec="select cal3,count(cal3) as hejis,sum(sum_m) as summoney           
from ka_ta where cal1='a' and cal3 in (select cal3                
from ka_ta where cal1='a') group by cal3 order by summoney desc;;"; 
$result=mysql_query($exec);                                                 
while ($rs=mysql_fetch_array($result)){                                     
?>    <tr>
 <td  align="center" nowrap bordercolor="cccccc" bgcolor="#FDF4CA">id==</td>
    <td align="center" nowrap><?php echo $rs['cal3'];?></td>
    <td align="center" nowrap><?php echo $rs['heji'];?></td>
    <td align="center" nowrap><?php echo $rs['summoney'];?></td>  </tr>
    
<?php
}
?>现在写的语句.显示出来的是.全部显出来了.
要添加一个条件按日期显示出来.
想添加一个选择框列表..比如当选择2010111时.只显示2010111 所查的内容出来.

解决方案 »

  1.   

    $exec="select cal3,count(cal3) as hejis,sum(sum_m) as summoney          
    from ka_ta where cal1='a' and cal3 in (select cal3               
    from ka_ta where cal1='a') and riqi='2010111' group by cal3 order by summoney desc;;";  
    $result=mysql_query($exec);        
      

  2.   

     谢谢呀. 但是这个只是指定的... 当我列表值里选择 2010112的时候.不得呀? 就是想触发呀.选择哪个就显示哪个相关日期的出来..可以吗?我改为这样也不得:$riqi=$_GET['riqi'];
    $riqi = intval($_Get['riqi']); 
    $exec="select cal3,count(cal3) as hejis,sum(sum_m) as summoney  
    from ka_ta where cal1='a' and cal3 in (select cal3  
    from ka_ta where cal1='a') and riqi=$riqi group by cal3 order by summoney desc;;";  
    $result=mysql_query($exec);  是不是哪里出错了.还少点什么