$insertsql=<<<EOTinsert into tb_manager values(null,'$name','$pwd','1');select @pid:=last_insert_id();//寻找最新插入记录ID并赋值给pid,pid进行传值insert into tb_mastergroup values(null,@pid,'$name',2,'1','MR');EOT;$sql=mysql_query($insertsql);…
创建两个表如图: sp_user表: sp_dept表: 目的:通过sp_user的dept_id查询所属部门即sp_dept中的name. 原生sq方法一:select t1.*,t2.name as deptname from sp_user as t1,sp_dept as t2 where t1.dept_id = t2.id; 原生sq方法二:select t1.*,t2.name as deptname from sp_user as t1 left join sp_dept as…