title: Insert first value from a table to another table Mysql PHP
body: <p>I have a table with column x and column ID. I am trying to get the first value from  column x  and insert it into column y from table b.</p>
  
  <p>here is what I have done and it doesn't work:</p>
  
  <pre><code>$val=mysql_query("SELECT x FROM table_a WHERE id=MIN(id)");
  $sql=mysql_query("INSERT INTO table_b (y) VALUES('$val')");
  </code></pre>
  
  <p>Also when I delete a value from table a column x I have to update the value from table b column y with previous value from table a.</p>