活到老学到老  

记录遇到问题的点点滴滴。

MYSQL使用inner join 进行 查询/删除/修改示例

8年前发布  · 972 次阅读

本文为大家介绍下使用inner join 进行查询/删除/修改,具体实现如下,学习mysql的朋也可以学习下,希望对大家有所帮助

查询

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'; 

删除

DELETE FROM jx_lsjl jx INNER JOIN isa_gtxx gt ON jx.ckid=gt.gtbh WHERE gt.jgm='27010825' AND jx.jgm='27010825';