$7.49 .com domain with free InstantPage Website Builder$1.99 Web Hosting   捷飞网络官方淘宝店   Godaddy 优惠码
返回列表 发帖
分享到:




[应用&技术] 分享MYSQL多表联合更新,查询

很多时候都会用到多表查询,更新,删除,替换.

MYSQL多表联合更新与SQL2000有所不同:


  j- t, ~' M' r5 S" Z/ D9 L2 T$ u! Tselect a.studnt_sno,b.sno,c.grade from studnt as a inner join depart as b on a.sno=b.sno left join sc as c on b.cno=c.no
3 i4 H7 }3 y$ L: {% B8 Jselect col1, col2, col..., a.*, b.*,c.* from tableA a, tableB b,tableC c WHERE a.**_id = b.**_id AND b.**_id = c.**_id and a.**_id=c.**_id

update tableA,tableB set tableA.colB= tableB.colB  where tableA.colA= tableB.colA;

  x/ ^% m9 L5 S  Q) S1 |4 b# |* l) I

对应的SQL2000更新语句为:

  update tableA set tableA.colB=tableB.colB from tableA,tableB where tableA.colA=tableB.colA

$ t6 }- Y$ |$ J3 k- ]4 V/ l

更多的自己去扩展吧..

返回列表
Namecheap
Namecheap.com - Cheap domain name registration, renewal and transfers - Free SSL Certificates - Web Hosting
互联网安全