从表一中获取一些日期,然后通过表单与其他数据进行更新,并在另一个表>中更新


Get some date from table one and update by a form with other data and update in another table >

Id(primary key)  name     age     option
01               shuvo     23     update mark
02               axiom     24     update mark
03               john      25     update mark

我想从那里更新标记,当我这样做时,我可以检索 id 并获取如下信息

id      subject            mark      
01      math              50
02      math              80
03      math              90

最后数据输出将是

名称主题标记

如何在 MySQL 和 php 中编写查询?

首先,您必须在第二个表中添加外键,然后使用 SQL 联接获取记录。

表1:学生
ID(主键(名称年龄选项

01 舒沃 23 更新标记
02 公理 24 更新标记
03 约翰 25 更新标记

表2:标记
FK_ID主题标记的 ID

01 1 数学 50
02 1 数学 80
03 2 数学 90

查询:选择姓名,主题,学生标记,标记 Student.Id = Marks.FK_ID;