摘要:使用情况:将某张表中的一些数据的name字段加上‘-DEL’后缀 使用concat拼接函数实现: update table1 set name=(select concat(name,'-DEL') from table1 where id = '123456') id需要是唯一值,返回结果集不能只
阅读全文
摘要:select --具体要查询的字段不展示,用*代表需要取出的字段 * from (select * from ts_drc_responsibility where CREATE_TIME > '2021-01-01 00:00:00') a left join catalog_res_associ
阅读全文
摘要:user表中有个type字段,数据类型为varchar,表里有条数据type字段为'7D',但在写sql的时候误将type字段当成integer。 select * from user where type = 7; 这时候会将type为‘7D’的数据查询出来。经过查阅资料,用integer去查询的
阅读全文
摘要:wmsys.wm_concat() 是属于oracle的分组连接字段函数, 作用与MySQL的group_concat函数相似 使用案例: SELECT cid,canme replace(WMSYS.WM_CONCAT(sage), ',', '|') FROM student GROUP BY
阅读全文
摘要:在项目开发中经常会出现一个查询字段包含多个查询内容的情况,在SQL中使用IN实现: SELECT * FROM user WHERE name IN ('张三','李四'); 在mybatis,使用foreach实现in的功能: <where> <if test="isAudit != null">
阅读全文
摘要:inner join(内连接),在两张表进行查询时,只保留两张表中完全匹配的结果集: select p.name,p.address,o.orderName from person p inner join orders o on p.id = o.id_p and 1 = 1 order by p
阅读全文