mysql按年季度统计、一个表字段更新到另一个表上
发表于:2021-12-24 09:45:30浏览:1271次
#按年季度统计数据
SELECT sum(money), quarter( FROM_UNIXTIME( `fh_time` ) ),year( FROM_UNIXTIME( fh_time ) ) ; FROM `dddd` group by year( FROM_UNIXTIME( fh_time ) ) ,quarter( FROM_UNIXTIME( `fh_time` ) );
#将一个表的字段更新导另一个表上
UPDATE dddd a INNER JOIN ( select b.name,a.uid from c_intermediary_user as a left join c_intermediary as b on a.parid=b.id ) b ON a.uid = b.uid SET a.area = b.name; UPDATE dddd a INNER JOIN ( select f.fuid,t.name from c_fritop as f left join (select b.name,a.uid from c_intermediary_user as a left join c_intermediary as b on a.parid=b.id) t on f.uid=t.uid ) b ON a.uid = b.fuid SET a.area = b.name where area='';
栏目分类全部>