INSERT INTO runwa(rshottime,rmoney,renamecount) VALUES (CURDATE(),(select SUM(MONEY)  from income where  CREATESHOTTIME = CURDATE()),(select count(distinct hostname) from income where  CREATESHOTTIME = CURDATE()));

 

1.查询某张表 一个字段的总和。(select SUM(MONEY) from income)

2.MYSQL里当天的时间(CURDATE())

3.查询某张表某个字段不同的值的数量。(select count(distinct hostname) from income)