如何将记录从表移动到具有所选字段的另一个表?

I need to move records to other table but I want a specific row or field like I want to move the student(table) records in the unvoted_logs but their are different field so I have to specific on inserting , I have a code but it doesn't work please I need help

Data structure

$stud ="INSERT INTO unvoted_logs(idno,syearid)
                            SELECT idno,syearid FROM SELECT st.* FROM student st LEFT  JOIN vote_logs sv ON st.idno = sv.idno AND st.syearid = sv.syearid
                            WHERE sv.idno IS NULL AND user_type='3'"; 
        $qa = $db->prepare($stud);

Hi this is rough pseudocode from what I have done. By a brief explaination, I have separated the code you have provided into three steps.

Firstly SQL create a view from the inner select table.

Secondly SQL select a record from the view table

Thirdly SQL insertion by a separate query.

Hope it helps. Thanks.

$sql1 = "Create OR Replace View [student joins votes] AS
    SELECT * FROM student st LEFT JOIN vote_logs sv 
            ON st.idno = sv.idno AND st.syearid = sv.syearid";
$qa = $db->prepare($sql1);
$qa->execute();


$sql2= "Select idno,syearid FROM [student joins votes] where WHERE idno IS NULL AND user_type='3'";
$qa = $db->query($sql2);

//only has one row in the database
if ($qa->num_rows == 1) {
    // output data of each row
    while($row = $qa->fetch_assoc()) {
        $idno = $row["idno"];
        $syearid = $row["syearid"];
        break;
    }
} 

if($idno!=null && $syearid!=null){
    $qa = $db->prepare("INSERT INTO unvoted_logs (idno, syearid) 
        VALUES (:idno, :syearid)");
        $qa->bindParam(':idno', $idno);
        $qa->bindParam(':syearid', $syearid);
        $qa->execute();
}

</div>