比如:从一个用户表中取出年龄分别是30 40 50 的用户名存在一个表中,有没有好的办法.   需要取出的表       : SelectTable(id,name,age)
需要清空并加入的表 : InsertTable(id,age30,age40,age50)需要判断 SelectTable 是否有更新;如果没有更新,就不用清空 InsertTable 并加入了. 如果能否判断出 SelectTable 哪条记录更新了,就直接更新 InsertTable 相应的值 就更好了.请问该怎样写???$sqlout  = "SELECT name FROM SelectTable where age=30 ";
$sqlout2 = "SELECT name FROM SelectTable where age=40 ";
$sqlout3 = "SELECT name FROM SelectTable where age=50 "; 
...... if (!mysql_query($sqlout)) {
  echo '原因:'.mysql_error();
} else{
$rowout = mysql_query($sqlout); 
$i=0;
while($rstout = mysql_fetch_array($rowout)){
$sqlin = "INSERT INTO InsertTable (age30) values('$rstout[$i]')";
mysql_query($sqlin);
$i++;
}}谢谢