现在有4张表,要求分别显示:
现在4张表中的id都是一样的,如何在开头写例如:id1=123,然后下面的条件中id=id1,这样就不用写入4遍,只需要将id1=123修改下就可以运行了。
select * from a where id='';
select * from b where id='';
select * from c where id='';
select * from d where id='';
------解决方案--------------------
定义变量v_id
select * from a where id=v_id;
select * from b where id=v_id;
select * from c where id=v_id;
select * from d where id=v_id;
------解决方案--------------------
绑定变量
------解决方案--------------------