mysql 复合查询语句

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)

原文地址:https://www.cnblogs.com/xuandi/p/7373599.html