2014-07-13 16:29:56
来 源
中存储网
MySQL
在mysql中,不能直接使用set select的结果,必须使用inner join:update a inner join (select yy from b) c on a.id =b.idset a.xx = c.yyupdatea inner join
mysql中,不能直接使用set select的结果,必须使用inner join:
 
update a inner join (select yy from b) c on a.id =b.id  set a.xx = c.yy
 

update a inner join (select ceiling(month(data_time)/3) as season  from a  group by ceiling(month(data_time)/3)) c on a.id =a.id  set a.season = c.season
 
 
update  sta_statistcs as a inner join (select   SUBSTRING_INDEX( result,   ',',   1) as   season from sta_statistcs) c on a.id =a.id  set a.data = c.season
 
mysql 字段分割符
select   SUBSTRING_INDEX( result,   ',' ,   1) from sta_statistcs;

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。