MySQL使用inner join查删改示例

代码如下:
 
–查询 
SELECT tp.tp_id, tp.tpmc, tp.leveid, tp.tpdz, tp.jgm, tp.scsj, tp.pbzyid, tp.ksbfsj, tp.jsbfsj, tp.status, tp.tpbz FROM qdgl_tupian tp INNER JOIN qdgl_pqb pq 
ON tp.tp_id=pq.tpid WHERE pq.bfjgm='27010825' AND ps_bfsj >= '2013-01' AND ps_bfsj< 2013-05-31 ; 
 
复制代码 代码如下:
 
— 修改 
UPDATE jx_lsjl jx INNER JOIN isa_gtxx gt ON jx.ckid=gt.gtbh set jx.ckid=gt.gtid WHERE gt.jgm='27010825' AND jx.jgm='27010825' ; 
 
表A和表B,现在希望更新A表,当 A.bid = B.id时,a.x = b.x, a.y=b.y,mysql中sql语句
update a inner join b on a.bid=b.id set a.x=b.x,a.y=b.y ;
 
 
 
复制代码 代码如下:
 
–删除 
DELETE FROM jx_lsjl jx INNER JOIN isa_gtxx gt ON jx.ckid=gt.gtbh WHERE gt.jgm='27010825' AND jx.jgm='27010825' ; 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注