我想將數據從一個表複製到另一個表。怎麼樣?在一個查詢中訪問3表
$P_studentnumber=mysql_real_escape_string($_POST['studentnumber']);
$P_subjectcode=mysql_real_escape_string($_POST['subjectcode']);
$P_semester=mysql_real_escape_string($_POST['semester']);
$sql "INSERT units INTO grades (units) FROM subjects WHERE subjectcode='$P_subjectcode'"; //<--THIS IS THE PART THAT I WOULD WANT TO ADD
$sql="INSERT INTO grades (studentnumber,course, subjectcode, semester, instructorname, units) SELECT '$P_studentnumber', course, '$P_subjectcode', '$P_semester','$instructorname', 'units' FROM students WHERE studentnumber='$P_studentnumber'";