摘要:UPDATE table_a JOIN table_b ON table_a.data_id = table_b.data_id SET table_a.name = table_b.name;
阅读全文
摘要:select JSON_EXTRACT(json字段,'$.name') from table
阅读全文
摘要:1、使用REPLACE()函数 UPDATE table SET field = REPLACE (field,'old_string','new_string')
阅读全文
摘要:SELECT @Pn:=id id, @pathId:=(SELECT GROUP_CONCAT(SUBSTRING_INDEX( @Pn:=(SELECT CONCAT(parent_id,'|',name) FROM org WHERE id = SUBSTRING_INDEX(@Pn,'|',
阅读全文
摘要:select id from (select t1.id,t1.name,if(find_in_set(parent_id, @pids) > 0,@pids:= concat(@pids, ',', id),0) as ischild from (select id,parent_id,name
阅读全文
摘要:SELECT DISTINCT name,sex,DATE_FORMAT(create_time,'%Y-%m-%d') FROM test
阅读全文
摘要:查询当前年份新增数据select * from test where YEAR(create_time) = YEAR(NOW()) 查询当去年份新增数据 select * from test where YEAR(create_time) = YEAR(NOW())-1 查询当前季度新增数据 se
阅读全文
摘要:1)按天统计: select DATE_FORMAT(start_time,'%Y%m%d') days,count(product_no) count from test group by days; 2)按周统计: select DATE_FORMAT(start_time,'%Y%u') we
阅读全文